:root {
  --ink: #112238;
  --muted: #69788b;
  --canvas: #f4f7f9;
  --surface: #ffffff;
  --line: #dfe6eb;
  --navy: #0d1c2e;
  --navy-2: #152a40;
  --green: #20c983;
  --green-dark: #087b50;
  --green-soft: #e8fbf3;
  --danger: #c5414c;
  --shadow: 0 18px 50px rgba(15, 34, 55, .08);
  --radius: 18px;
  font-family: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-size: 16px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.eyebrow { color: var(--green-dark); font-size: .76rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 26px 18px; display: flex; flex-direction: column; color: #d8e4ec; background: var(--navy); border-right: 1px solid rgba(255,255,255,.07); z-index: 30; }
.brand, .login-brand { display: flex; align-items: center; gap: 12px; font-size: 1.1rem; }
.brand-mark, .login-brand span { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: var(--navy); background: var(--green); font-weight: 900; box-shadow: 0 8px 24px rgba(32,201,131,.22); }
.brand strong, .brand small { display: block; }
.brand small { margin-top: 2px; color: #8396a7; font-size: .72rem; font-weight: 500; }
.nav-list { display: grid; gap: 5px; margin-top: 42px; }
.nav-link { display: flex; align-items: center; gap: 13px; min-height: 45px; padding: 0 13px; border-radius: 11px; color: #9fb0be; font-size: .91rem; font-weight: 600; transition: background .16s ease, color .16s ease, transform .16s ease; }
.nav-link:hover { color: #fff; background: rgba(255,255,255,.055); transform: translateX(2px); }
.nav-link.active { color: #fff; background: var(--navy-2); box-shadow: inset 3px 0 var(--green); }
.nav-link.active svg { color: var(--green); }
.sidebar-status { margin-top: auto; padding: 14px; display: flex; align-items: center; gap: 10px; border: 1px solid rgba(255,255,255,.08); border-radius: 13px; background: rgba(255,255,255,.035); }
.sidebar-status strong, .sidebar-status small { display: block; }
.sidebar-status strong { color: #eaf4f8; font-size: .79rem; }
.sidebar-status small { margin-top: 2px; color: #8294a3; font-size: .7rem; }
.status-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(32,201,131,.1); }
.main-column { min-width: 0; }
.topbar { min-height: 78px; padding: 0 clamp(20px, 3vw, 42px); display: flex; align-items: center; gap: 18px; background: rgba(255,255,255,.9); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.topbar-title strong { display: block; margin-top: 3px; font-size: 1rem; }
.topbar-title .eyebrow { font-size: .64rem; }
.account { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; color: var(--green-dark); background: var(--green-soft); font-weight: 900; }
.account-copy strong, .account-copy small { display: block; }
.account-copy strong { max-width: 160px; overflow: hidden; text-overflow: ellipsis; font-size: .84rem; white-space: nowrap; }
.account-copy small { margin-top: 2px; color: var(--muted); font-size: .65rem; letter-spacing: .08em; }
.text-button { padding: 7px 10px; color: var(--muted); background: transparent; border: 0; cursor: pointer; font-size: .8rem; font-weight: 700; }
.text-button:hover { color: var(--danger); }
.menu-button { display: none; }
.icon-button { width: 40px; height: 40px; place-items: center; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--surface); }
.page-content { width: min(1440px, 100%); margin: 0 auto; padding: 36px clamp(20px, 3vw, 42px) 60px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 25px; }
.page-heading h1 { margin: 7px 0 6px; font-size: clamp(1.65rem, 3vw, 2.25rem); letter-spacing: -.045em; }
.page-heading p { margin: 0; color: var(--muted); }
.date-chip, .neutral-chip, .phase-badge { padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--surface); font-size: .76rem; font-weight: 700; }
.setup-banner { margin-bottom: 22px; padding: 15px 17px; display: flex; align-items: center; gap: 13px; border: 1px solid #f2d59f; border-radius: 14px; background: #fff9ee; }
.setup-banner.success { border-color: #bcead7; background: var(--green-soft); }
.setup-icon { width: 30px; height: 30px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; color: #815200; background: #ffe8b8; font-weight: 900; }
.setup-banner.success .setup-icon { color: var(--green-dark); background: #c9f4e2; }
.setup-banner strong, .setup-banner p { display: block; }
.setup-banner strong { font-size: .87rem; }
.setup-banner p { margin: 3px 0 0; color: var(--muted); font-size: .8rem; }
.setup-banner a { margin-left: auto; color: var(--green-dark); font-size: .8rem; font-weight: 800; }
.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.metric-card, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 35px rgba(15,34,55,.045); }
.metric-card { min-height: 142px; padding: 17px; }
.metric-top { display: flex; align-items: center; justify-content: space-between; }
.metric-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; background: var(--green-soft); }
.metric-icon::after { content: ''; width: 8px; height: 8px; border: 2px solid var(--green-dark); border-radius: 50%; }
.metric-trend { color: #8996a4; font-size: .66rem; font-weight: 700; text-transform: uppercase; }
.metric-card > strong { display: block; margin-top: 16px; font-size: 1.65rem; letter-spacing: -.04em; }
.metric-card > span:last-child { display: block; margin-top: 4px; color: var(--muted); font-size: .75rem; line-height: 1.3; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 18px; margin-top: 18px; }
.panel { padding: 21px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.panel-heading h2 { margin: 5px 0 0; font-size: 1.02rem; }
.panel-heading a { color: var(--green-dark); font-size: .78rem; font-weight: 800; }
.empty-chart { height: 176px; padding: 30px 10px 0; display: grid; grid-template-columns: repeat(7, 1fr); align-items: end; gap: 12px; border-bottom: 1px solid var(--line); background-image: linear-gradient(to bottom, transparent 32%, #eef2f5 33%, transparent 34%, transparent 65%, #eef2f5 66%, transparent 67%); }
.empty-chart span { height: var(--h); min-height: 18px; border-radius: 6px 6px 0 0; background: #dfe9e5; }
.chart-labels { padding: 10px 5px 0; display: grid; grid-template-columns: repeat(7, 1fr); color: #8a97a5; font-size: .68rem; text-align: center; }
.empty-state { min-height: 226px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-symbol { width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid #cfe4da; border-radius: 14px; color: var(--green-dark); background: var(--green-soft); font-size: 1.35rem; }
.empty-state strong { margin-top: 13px; font-size: .88rem; }
.empty-state p, .module-placeholder p { max-width: 460px; margin: 5px auto 0; color: var(--muted); font-size: .78rem; line-height: 1.55; }
.recent-panel { margin-top: 18px; }
.empty-row { margin-top: 17px; padding: 22px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px dashed #ccd7df; border-radius: 13px; color: var(--muted); font-size: .83rem; }
.empty-row small { color: #909daa; }
.module-placeholder { min-height: 390px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.module-placeholder h2 { margin: 15px 0 0; }
.phase-badge { margin-bottom: 18px; color: var(--green-dark); border-color: #c8eadb; background: var(--green-soft); }
.mobile-overlay { display: none; }

.guest-body { color: #e9f1f5; background: var(--navy); }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(440px, .9fr); }
.login-story { position: relative; min-height: 100vh; padding: clamp(42px, 7vw, 96px); display: flex; align-items: center; overflow: hidden; background: radial-gradient(circle at 75% 32%, rgba(32,201,131,.15), transparent 34%), linear-gradient(145deg, #0b1929, #112a3e); }
.login-story::before { content: ''; position: absolute; inset: 0; opacity: .15; background-image: linear-gradient(rgba(255,255,255,.1) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.1) 1px, transparent 1px); background-size: 48px 48px; mask-image: linear-gradient(to right, black, transparent); }
.story-content { position: relative; z-index: 2; max-width: 660px; }
.story-kicker { display: inline-flex; align-items: center; gap: 9px; color: #9db1bd; font-size: .74rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.story-kicker span { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(32,201,131,.1); }
.story-content h1 { margin: 22px 0; font-size: clamp(3rem, 6vw, 6rem); line-height: .98; letter-spacing: -.065em; }
.story-content h1 em { color: var(--green); font-style: normal; }
.story-content > p { max-width: 570px; color: #a7b8c3; font-size: clamp(1rem, 1.4vw, 1.14rem); line-height: 1.7; }
.story-steps { margin-top: 46px; display: flex; align-items: center; gap: 14px; color: #8fa1ae; font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.story-steps i { width: 38px; height: 1px; background: linear-gradient(to right, #375166, var(--green)); }
.story-orbit { position: absolute; right: -170px; bottom: -220px; width: 520px; height: 520px; border: 1px solid rgba(32,201,131,.12); border-radius: 50%; }
.story-orbit span { position: absolute; inset: 70px; border: 1px solid rgba(32,201,131,.1); border-radius: 50%; }
.story-orbit span:nth-child(2) { inset: 145px; }
.story-orbit span:nth-child(3) { inset: 215px; background: rgba(32,201,131,.15); }
.login-panel { padding: 40px; display: grid; place-items: center; color: var(--ink); background: #f7fafb; }
.login-card { width: min(420px, 100%); }
.login-brand { width: max-content; font-weight: 900; letter-spacing: -.02em; }
.login-brand span { width: 36px; height: 36px; }
.login-heading { margin: 62px 0 28px; }
.login-heading h2 { margin: 9px 0 7px; font-size: 2rem; letter-spacing: -.045em; }
.login-heading p { margin: 0; color: var(--muted); line-height: 1.5; }
.alert { margin-bottom: 18px; padding: 12px 14px; border-radius: 10px; font-size: .83rem; line-height: 1.45; }
.alert-error { color: #8f2933; border: 1px solid #efc2c7; background: #fff0f1; }
.alert-success { color: #075f3e; border: 1px solid #bcead7; background: var(--green-soft); }
.login-form { display: grid; }
.login-form label { margin: 0 0 7px; font-size: .82rem; font-weight: 800; }
.login-form input { width: 100%; height: 48px; margin-bottom: 19px; padding: 0 14px; color: var(--ink); border: 1px solid #cfd9e0; border-radius: 11px; outline: none; background: #fff; transition: border .15s, box-shadow .15s; }
.login-form input:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(32,201,131,.12); }
.password-field { position: relative; }
.password-field input { padding-right: 82px; }
.password-field button { position: absolute; top: 8px; right: 8px; padding: 7px 8px; color: var(--green-dark); border: 0; background: transparent; cursor: pointer; font-size: .75rem; font-weight: 800; }
.primary-button { height: 50px; margin-top: 6px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; color: #072417; border: 0; border-radius: 11px; background: var(--green); box-shadow: 0 12px 30px rgba(32,201,131,.2); cursor: pointer; font-weight: 900; transition: transform .16s, box-shadow .16s; }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 16px 34px rgba(32,201,131,.26); }
.security-note { margin: 25px 0 0; color: #8593a0; font-size: .74rem; text-align: center; }
.security-note span { margin-right: 5px; color: var(--green-dark); }

.primary-link, .secondary-link { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 800; }
.primary-link { min-height: 44px; padding: 0 16px; color: #072417; border-radius: 11px; background: var(--green); box-shadow: 0 10px 26px rgba(32,201,131,.18); }
.secondary-link { color: var(--green-dark); font-size: .82rem; }
.back-link { display: inline-block; margin-bottom: 8px; color: var(--green-dark); font-size: .8rem; font-weight: 800; }
.create-instance-panel { margin-bottom: 18px; scroll-margin-top: 24px; }
.inline-form { margin-top: 20px; display: grid; grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto; align-items: end; gap: 14px; }
.inline-form label > span { display: block; margin-bottom: 7px; font-size: .78rem; font-weight: 800; }
.inline-form input { width: 100%; height: 46px; padding: 0 13px; border: 1px solid #cfd9e0; border-radius: 10px; color: var(--ink); background: #fff; outline: none; }
.inline-form input:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(32,201,131,.12); }
.primary-button.compact { min-width: 160px; height: 46px; margin: 0; }
.instance-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.instance-card { min-height: 285px; display: flex; flex-direction: column; }
.instance-card-top, .group-title-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.instance-card h2 { margin: 24px 0 3px; font-size: 1.17rem; letter-spacing: -.025em; }
.instance-id { margin: 0; color: var(--muted); font: .76rem ui-monospace, SFMono-Regular, Consolas, monospace; }
.provider-label { color: #8593a0; font-size: .68rem; font-weight: 800; letter-spacing: .08em; }
.status-badge { width: max-content; padding: 7px 10px; display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; font-size: .7rem; font-weight: 850; white-space: nowrap; }
.status-badge i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-connected { color: #08734b; background: #e1f8ee; }
.status-connecting { color: #946000; background: #fff3d6; }
.status-disconnected { color: #657487; background: #eef2f5; }
.status-error { color: #a12d38; background: #fde9eb; }
.instance-stats { margin: 24px 0; display: grid; grid-template-columns: 1.5fr .7fr .7fr; gap: 9px; }
.instance-stats div { min-width: 0; }
.instance-stats dt, .detail-list dt, .group-meta span { color: var(--muted); font-size: .67rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.instance-stats dd { margin: 5px 0 0; overflow: hidden; text-overflow: ellipsis; font-size: .78rem; font-weight: 800; white-space: nowrap; }
.instance-card > .secondary-link { margin-top: auto; justify-content: space-between; padding-top: 16px; border-top: 1px solid var(--line); }
.phase-empty { min-height: 310px; margin-top: 18px; }
.phase-empty .secondary-link { margin-top: 16px; }
.connection-grid { display: grid; grid-template-columns: minmax(320px, .9fr) minmax(420px, 1.1fr); gap: 18px; }
.connection-side { display: grid; gap: 18px; }
.qr-stage { min-height: 360px; margin-top: 18px; display: grid; place-items: center; border: 1px dashed #cbd8df; border-radius: 15px; background: #f9fbfc; text-align: center; }
.qr-stage img { width: min(290px, 82%); aspect-ratio: 1; object-fit: contain; border: 12px solid #fff; border-radius: 12px; box-shadow: var(--shadow); }
.qr-stage strong { display: block; margin-top: 13px; font-size: .9rem; }
.qr-stage p { max-width: 300px; margin: 6px auto 0; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.qr-help, .panel-copy { margin: 14px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.55; }
.detail-list { margin: 20px 0 0; }
.detail-list div { padding: 13px 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.detail-list div:last-child { border-bottom: 0; }
.detail-list dd { margin: 0; color: var(--ink); font-size: .8rem; font-weight: 800; text-align: right; }
.button-row { margin-top: 20px; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.button-row form { margin: 0; }
.outline-button, .category-editor > summary { min-height: 42px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); border: 1px solid #ccd7df; border-radius: 10px; background: #fff; cursor: pointer; font-size: .78rem; font-weight: 800; }
.outline-button:hover, .category-editor > summary:hover { border-color: #9eb2bf; background: #f7fafb; }
.outline-button:disabled { cursor: not-allowed; opacity: .45; }
.danger-outline { color: var(--danger); border-color: #e9c4c8; }
.group-list { display: grid; gap: 13px; }
.group-card { display: grid; grid-template-columns: minmax(0, 1fr) 150px auto; align-items: center; gap: 22px; }
.group-card.unavailable { opacity: .62; }
.group-main { min-width: 0; display: flex; align-items: flex-start; gap: 14px; }
.group-icon { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; color: var(--green-dark); border-radius: 12px; background: var(--green-soft); font-weight: 900; }
.group-title-line { justify-content: flex-start; }
.group-title-line h2 { max-width: 550px; margin: 0; overflow: hidden; text-overflow: ellipsis; font-size: .95rem; white-space: nowrap; }
.group-main p { margin: 5px 0 0; color: var(--muted); font-size: .75rem; }
.category-tags { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.category-tags span { padding: 4px 7px; color: #315f4d; border-radius: 6px; background: #eef8f4; font-size: .66rem; font-weight: 750; }
.category-tags .muted-tag { color: var(--muted); background: #f0f3f5; }
.group-meta strong { display: block; margin-top: 5px; font-size: .75rem; }
.group-actions { display: flex; align-items: center; gap: 8px; }
.category-editor { position: relative; }
.category-editor > summary { list-style: none; }
.category-editor > summary::-webkit-details-marker { display: none; }
.category-editor[open] form { position: absolute; right: 0; top: calc(100% + 8px); z-index: 10; width: min(380px, 82vw); padding: 17px; border: 1px solid var(--line); border-radius: 13px; background: #fff; box-shadow: var(--shadow); }
.checkbox-grid { max-height: 270px; overflow: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.checkbox-grid label { min-height: 38px; padding: 8px; display: flex; align-items: center; gap: 8px; border: 1px solid #e4eaee; border-radius: 8px; font-size: .73rem; font-weight: 650; }
.checkbox-grid input { accent-color: var(--green-dark); }
.category-editor .primary-button { width: 100%; margin-top: 13px; }
.provider-guide { margin-top: 18px; scroll-margin-top: 24px; }
.provider-guide ol { margin: 22px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; list-style: none; counter-reset: guide; }
.provider-guide li { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #fafcfd; counter-increment: guide; }
.provider-guide li::before { content: counter(guide); width: 28px; height: 28px; margin-bottom: 14px; display: grid; place-items: center; color: #073a27; border-radius: 9px; background: var(--green); font-size: .76rem; font-weight: 900; }
.provider-guide li strong, .provider-guide li span { display: block; }
.provider-guide li strong { font-size: .82rem; }
.provider-guide li span, .provider-guide > p { margin-top: 6px; color: var(--muted); font-size: .75rem; line-height: 1.5; }

/* Fase 3: catalogo, marketplaces e historico de precos */
.product-metrics { margin-bottom: 18px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.compact-metric { min-height: 118px; }
.compact-metric > span:first-child { color: var(--muted); font-size: .72rem; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.compact-metric > strong { margin-top: 10px; font-size: 1.55rem; }
.compact-metric small { display: block; margin-top: 3px; color: var(--muted); font-size: .7rem; }
.marketplace-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.marketplace-panel { min-height: 285px; scroll-margin-top: 24px; }
.marketplace-panel code { padding: 2px 5px; border-radius: 5px; background: #eef2f5; }
.shopee-panel { background: linear-gradient(145deg, #fff 55%, #fff5ef); }
.inline-link { width: max-content; margin-top: 18px; }
.stack-form { margin-top: 18px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; }
.stack-form.catalog-import-form { grid-template-columns: minmax(240px, 2fr) minmax(125px, .65fr) minmax(125px, .65fr) auto; }
.stack-form label > span, .product-form label > span { display: block; margin-bottom: 7px; color: var(--ink); font-size: .73rem; font-weight: 800; }
.stack-form input, .search-form input, .catalog-filter input, .catalog-filter select, .product-form input, .product-form select, .product-form textarea { width: 100%; min-height: 44px; padding: 10px 12px; color: var(--ink); border: 1px solid #cfd9e0; border-radius: 10px; background: #fff; outline: none; }
.product-form textarea { min-height: 100px; resize: vertical; }
.stack-form input:focus, .search-form input:focus, .catalog-filter input:focus, .catalog-filter select:focus, .product-form input:focus, .product-form select:focus, .product-form textarea:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(32,201,131,.1); }
.search-box { margin-top: 16px; }
.search-box > summary { width: max-content; color: var(--green-dark); cursor: pointer; font-size: .77rem; font-weight: 800; }
.search-form { margin-top: 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
.search-results, .manual-panel { margin-top: 18px; scroll-margin-top: 24px; }
.result-grid { margin-top: 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.result-card { min-width: 0; padding: 12px; display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: 12px; border: 1px solid #e1e8ec; border-radius: 13px; }
.result-card h3 { margin: 4px 0 6px; display: -webkit-box; overflow: hidden; font-size: .8rem; line-height: 1.35; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.result-card small { color: var(--muted); font-size: .65rem; }
.result-card strong { font-size: .87rem; }
.result-card em { margin-left: 8px; color: var(--green-dark); font-size: .65rem; font-style: normal; font-weight: 750; }
.product-thumb { width: 64px; height: 64px; display: grid; place-items: center; overflow: hidden; color: var(--green-dark); border: 1px solid #e2e9ed; border-radius: 12px; background: #f7faf9; font-weight: 900; }
.product-thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.product-form { margin-top: 20px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.product-form .wide { grid-column: span 2; }
.form-submit { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.form-submit p { margin: 0; color: var(--muted); font-size: .73rem; }
.catalog-section { margin-top: 30px; }
.catalog-heading { margin-bottom: 14px; display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.catalog-heading h2 { margin: 5px 0 0; font-size: 1.12rem; }
.catalog-filter { width: min(620px, 100%); display: grid; grid-template-columns: minmax(170px, 1fr) 170px auto; gap: 8px; }
.product-list { display: grid; gap: 10px; }
.product-row { min-height: 104px; padding: 14px 16px; display: grid; grid-template-columns: 68px minmax(0, 1fr) 145px 70px 24px; align-items: center; gap: 15px; transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease; }
.product-row:hover { border-color: #b9c9d1; transform: translateY(-1px); box-shadow: var(--shadow); }
.product-main { min-width: 0; }
.product-main h3 { margin: 7px 0 4px; overflow: hidden; text-overflow: ellipsis; font-size: .9rem; white-space: nowrap; }
.product-main small { color: var(--muted); font-size: .67rem; }
.marketplace-pill, .availability { padding: 4px 7px; display: inline-block; border-radius: 6px; font-size: .61rem; font-weight: 850; text-transform: uppercase; letter-spacing: .04em; }
.marketplace-pill { color: #26658f; background: #eaf5fc; }
.marketplace-shopee { color: #a8421e; background: #fff0e9; }
.marketplace-manual { color: #66587c; background: #f2eef8; }
.availability { margin-left: 6px; color: #7b8792; background: #f0f3f5; }
.availability.available { color: #08734b; background: #e1f8ee; }
.product-price { text-align: right; }
.product-price del, .product-price strong, .product-price span { display: block; }
.product-price del { color: var(--muted); font-size: .67rem; }
.product-price strong { margin-top: 3px; font-size: .98rem; }
.product-price span { margin-top: 3px; color: var(--green-dark); font-size: .64rem; font-weight: 850; }
.history-count { text-align: center; }
.history-count strong, .history-count span { display: block; }
.history-count strong { font-size: .9rem; }
.history-count span { margin-top: 3px; color: var(--muted); font-size: .62rem; }
.row-arrow { color: var(--green-dark); font-weight: 900; }
.product-detail-heading { align-items: center; }
.product-detail-heading h1 { max-width: 920px; }
.product-detail-grid { display: grid; grid-template-columns: minmax(280px, .65fr) minmax(0, 1.35fr); align-items: start; gap: 18px; }
.detail-column { display: grid; gap: 18px; }
.product-summary { position: sticky; top: 18px; }
.product-hero-image { min-height: 300px; display: grid; place-items: center; overflow: hidden; color: var(--muted); border: 1px solid #e1e8ec; border-radius: 14px; background: #f8fafb; font-size: .78rem; }
.product-hero-image img { width: 100%; height: 300px; object-fit: contain; background: #fff; }
.summary-price { margin-top: 18px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.summary-price del { color: var(--muted); font-size: .77rem; }
.summary-price strong { font-size: 1.55rem; letter-spacing: -.04em; }
.summary-price span { padding: 5px 8px; color: var(--green-dark); border-radius: 6px; background: var(--green-soft); font-size: .67rem; font-weight: 900; }
.external-product-link { width: 100%; margin-top: 18px; }
.price-history-list { max-height: 335px; margin-top: 18px; overflow: auto; }
.price-history-list > div { position: relative; min-height: 54px; padding: 8px 48px 8px 24px; display: grid; grid-template-columns: 120px minmax(0, 1fr); align-items: center; border-left: 1px solid #d9e5e0; }
.history-marker { position: absolute; left: -5px; width: 9px; height: 9px; border: 2px solid #fff; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 1px #b9d9ca; }
.price-history-list strong { font-size: .86rem; }
.price-history-list small { color: var(--muted); font-size: .7rem; }
.price-history-list em { position: absolute; right: 6px; padding: 4px 6px; color: var(--green-dark); border-radius: 5px; background: var(--green-soft); font-size: .61rem; font-style: normal; font-weight: 850; }
.history-note { margin: 14px 0 0; padding: 11px 12px; color: #6d5a32; border-radius: 9px; background: #fff8e9; font-size: .7rem; line-height: 1.45; }

/* Fase 3.1: monitoramento proprio e ofertas detectadas */
.monitoring-panel { margin-bottom: 18px; scroll-margin-top: 24px; background: linear-gradient(135deg, #fff 58%, #effbf6); }
.monitor-form { margin-top: 20px; display: grid; grid-template-columns: minmax(260px, 1.5fr) 190px minmax(240px, 1fr) auto; align-items: end; gap: 12px; }
.monitor-form label > span { display: block; margin-bottom: 7px; font-size: .73rem; font-weight: 800; }
.monitor-form input, .monitor-form select, .vertical-form input, .vertical-form select { width: 100%; min-height: 44px; padding: 10px 12px; color: var(--ink); border: 1px solid #cfd9e0; border-radius: 10px; background: #fff; outline: none; }
.monitor-form input:focus, .monitor-form select:focus, .vertical-form input:focus, .vertical-form select:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(32,201,131,.1); }
.monitor-form button:disabled { cursor: not-allowed; opacity: .5; }
.monitor-guardrails { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 7px; }
.monitor-guardrails span { padding: 5px 8px; color: #496459; border-radius: 6px; background: rgba(32,201,131,.09); font-size: .66rem; font-weight: 750; }
.monitor-error { margin-top: 14px; padding: 11px 12px; display: grid; gap: 4px; color: #8c3038; border: 1px solid #f0c9cd; border-radius: 9px; background: #fff5f6; }
.monitor-error strong { font-size: .72rem; }
.monitor-error span { font-size: .7rem; line-height: 1.4; }
.automation-forms { margin-top: 18px; display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 14px; }
.vertical-form { margin: 0; padding: 15px; display: grid; grid-template-columns: 1fr; align-items: stretch; border: 1px solid var(--line); border-radius: 12px; background: #fafcfd; }
.vertical-form p { margin: 0; color: var(--muted); font-size: .7rem; line-height: 1.45; }
.offer-tabs { margin: -8px 0 18px; display: flex; flex-wrap: wrap; gap: 7px; }
.offer-tabs a { padding: 8px 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: .75rem; font-weight: 800; }
.offer-tabs a.active { color: #073f2a; border-color: #a9dfc8; background: var(--green-soft); }
.offer-list { display: grid; gap: 10px; }
.offer-row { min-height: 98px; display: grid; grid-template-columns: 64px minmax(0, 1fr) 150px auto; align-items: center; gap: 16px; }
.offer-main { min-width: 0; }
.offer-main h2 { margin: 7px 0 4px; overflow: hidden; text-overflow: ellipsis; font-size: .92rem; white-space: nowrap; }
.offer-main small { color: var(--muted); font-size: .68rem; }

/* Fase 4: revisao de ofertas e providers de afiliados */
.heading-actions { margin: 0; }
.heading-actions .primary-button { margin: 0; }
.offer-metrics { margin-top: 0; }
.offer-workbench { margin-bottom: 22px; scroll-margin-top: 20px; background: linear-gradient(135deg, #fff 62%, #f0faf6); }
.offer-form { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.phase-four-row { grid-template-columns: 64px minmax(0, 1fr) 145px 170px; }
.offer-main h2 a:hover { color: var(--green-dark); }
.reason-tags { margin: 5px 0 6px; display: flex; flex-wrap: wrap; gap: 5px; }
.reason-tags span { padding: 3px 6px; color: #315f4d; border-radius: 5px; background: #eef8f4; font-size: .61rem; font-weight: 750; }
.offer-review { display: grid; justify-items: end; gap: 9px; }
.offer-actions { display: flex; gap: 5px; }
.offer-actions form { margin: 0; }
.mini-action { min-height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; background: #fff; cursor: pointer; font-size: .66rem; font-weight: 800; }
.approve-action { color: var(--green-dark); border-color: #bce4d3; }
.reject-action { color: var(--danger); border-color: #edc9cd; }
.evidence-list { margin-top: 18px; display: grid; gap: 9px; }
.evidence-list > div { padding: 12px; display: flex; align-items: flex-start; gap: 11px; border: 1px solid var(--line); border-radius: 11px; background: #fafcfd; }
.evidence-icon { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; color: #073f2a; border-radius: 9px; background: var(--green); font-size: .75rem; font-weight: 900; }
.evidence-list strong, .evidence-list small { display: block; }
.evidence-list strong { font-size: .8rem; }
.evidence-list small { margin-top: 4px; color: var(--muted); font-size: .69rem; }
.review-panel .button-row { margin-bottom: 0; }
.phase-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 18px; align-items: start; }
.template-form, .campaign-form { margin-top: 18px; }
.template-form textarea { min-height: 410px; line-height: 1.55; }
.template-list { display: grid; gap: 10px; margin-top: 16px; }
.template-list article { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.template-list strong, .template-list small, .responsive-table td small { display: block; }
.template-list small, .responsive-table td small { margin-top: 4px; color: var(--muted); font-size: .72rem; }
.check-option { display: flex !important; align-items: flex-start; gap: 10px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.check-option input { width: 18px !important; min-height: 18px !important; margin-top: 2px; accent-color: var(--green); }
.check-option small { display: block; margin-top: 3px; color: var(--muted); }
.group-selector { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.group-selector legend { padding: 0 7px; font-size: .78rem; font-weight: 800; }
.campaigns-list-panel { margin-top: 18px; }
.responsive-table { width: 100%; margin-top: 16px; overflow-x: auto; }
.responsive-table table { width: 100%; border-collapse: collapse; font-size: .78rem; }
.responsive-table th { padding: 10px 12px; color: var(--muted); text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.responsive-table td { padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.error-cell { max-width: 300px; white-space: normal; }
.preview-grid { display: grid; grid-template-columns: minmax(300px, .9fr) minmax(300px, .6fr); gap: 18px; align-items: start; }
.whatsapp-preview { background: #e9f2ed; }
.preview-image { min-height: 170px; display: grid; place-items: center; overflow: hidden; color: var(--muted); background: #fff; border-radius: 12px; }
.preview-image img { width: 100%; max-height: 380px; object-fit: contain; }
.message-bubble { max-width: 92%; margin: 15px 0 10px auto; padding: 14px; line-height: 1.52; white-space: normal; background: #d9fdd3; border-radius: 12px 2px 12px 12px; box-shadow: 0 2px 8px rgba(15,34,55,.08); }
.whatsapp-preview > a { display: block; overflow-wrap: anywhere; color: var(--green-dark); font-size: .75rem; }
.preview-summary { position: sticky; top: 88px; }
.preview-summary ul { display: grid; gap: 8px; padding: 0; list-style: none; }
.preview-summary li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.preview-summary li small { display: block; margin-top: 3px; color: var(--muted); }
.preview-actions { display: flex; flex-wrap: wrap; gap: 9px; margin: 18px 0; }
.preview-actions button:disabled { opacity: .45; cursor: not-allowed; }
.no-margin { margin: 0; }
.campaign-details { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 18px; align-items: start; }
.settings-form { margin-top: 18px; }
.pause-option { align-self: end; min-height: 67px; }
.worker-panel { position: sticky; top: 88px; }
.logs-panel { margin-top: 18px; }
.log-filters { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(160px, .65fr) auto auto auto; gap: 10px; align-items: end; }
.log-filters label > span { display: block; margin-bottom: 7px; color: var(--muted); font-size: .72rem; font-weight: 800; }
.log-filters input, .log-filters select { width: 100%; min-height: 42px; padding: 9px 11px; color: var(--ink); border: 1px solid #cfd9e0; border-radius: 10px; background: #fff; }
.real-chart { height: 235px; display: grid; grid-template-columns: repeat(7, 1fr); align-items: end; gap: 10px; margin-top: 18px; padding-top: 24px; }
.chart-column { height: 100%; display: grid; grid-template-rows: 20px 1fr 20px; align-items: end; text-align: center; }
.chart-column i { width: min(34px, 70%); height: var(--h); min-height: 5px; justify-self: center; border-radius: 7px 7px 2px 2px; background: linear-gradient(180deg, var(--green), #0b9b67); }
.chart-column small, .chart-value { color: var(--muted); font-size: .7rem; font-style: normal; }
.dashboard-list, .recent-offers { display: grid; margin-top: 14px; }
.dashboard-list a, .recent-offers a { display: flex; align-items: center; gap: 11px; padding: 12px 0; color: var(--ink); border-bottom: 1px solid var(--line); text-decoration: none; }
.dashboard-list a > span, .recent-offers a > span { min-width: 0; flex: 1; }
.dashboard-list strong, .dashboard-list small, .recent-offers strong, .recent-offers small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-list small, .recent-offers small { margin-top: 4px; color: var(--muted); font-size: .7rem; }
.dashboard-list time, .recent-offers b { flex: 0 0 auto; color: var(--green-dark); font-size: .72rem; }
.recent-thumb { width: 44px; height: 44px; display: grid; flex: 0 0 auto; place-items: center; overflow: hidden; border-radius: 9px; background: var(--soft); }
.recent-thumb img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .instance-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .group-card { grid-template-columns: minmax(0, 1fr) auto; }
  .group-meta { display: none; }
  .product-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .monitor-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .monitor-url, .monitor-affiliate { grid-column: span 2; }
  .offer-row { grid-template-columns: 64px minmax(0, 1fr) auto; }
  .offer-row .product-price { grid-column: 2; text-align: left; }
  .phase-four-row .offer-review { grid-column: 3; grid-row: 1 / span 2; }
  .result-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; transform: translateX(-105%); width: min(285px, 86vw); transition: transform .2s ease; }
  .sidebar-open .sidebar { transform: translateX(0); }
  .mobile-overlay { position: fixed; inset: 0; z-index: 20; background: rgba(5,15,25,.58); }
  .sidebar-open .mobile-overlay { display: block; }
  .menu-button { display: grid; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; }
  .login-story { display: none; }
  .login-panel { min-height: 100vh; padding: 30px 22px; }
  .inline-form, .connection-grid { grid-template-columns: 1fr; }
  .group-card { align-items: flex-start; grid-template-columns: 1fr; }
  .group-actions { padding-top: 14px; border-top: 1px solid var(--line); }
  .provider-guide ol { grid-template-columns: 1fr; }
  .product-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .marketplace-grid, .product-detail-grid { grid-template-columns: 1fr; }
  .automation-forms { grid-template-columns: 1fr; }
  .product-summary { position: static; }
  .phase-grid, .preview-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .preview-summary { position: static; }
  .worker-panel { position: static; }
  .log-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .campaign-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-heading { align-items: stretch; flex-direction: column; }
  .catalog-filter { width: 100%; }
  .product-row { grid-template-columns: 64px minmax(0, 1fr) 125px 24px; }
  .history-count { display: none; }
}

@media (max-width: 620px) {
  .topbar { min-height: 68px; padding: 0 14px; }
  .topbar-title .eyebrow, .account-copy { display: none; }
  .text-button { padding-right: 0; }
  .page-content { padding: 27px 16px 46px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .metric-card { min-height: 132px; padding: 14px; }
  .setup-banner { align-items: flex-start; flex-wrap: wrap; }
  .setup-banner a { width: 100%; margin-left: 43px; }
  .panel { padding: 17px; }
  .empty-row { align-items: flex-start; flex-direction: column; }
  .instance-grid { grid-template-columns: 1fr; }
  .instance-card { min-height: 260px; }
  .group-title-line { align-items: flex-start; flex-direction: column; gap: 7px; }
  .group-title-line h2 { max-width: 100%; white-space: normal; }
  .group-actions { align-items: stretch; flex-direction: column; }
  .group-actions form, .group-actions .outline-button, .category-editor, .category-editor > summary { width: 100%; }
  .category-editor[open] form { position: static; width: 100%; margin-top: 8px; box-shadow: none; }
  .checkbox-grid { grid-template-columns: 1fr; }
  .product-form { grid-template-columns: 1fr; }
  .product-form .wide { grid-column: auto; }
  .form-submit { align-items: stretch; flex-direction: column; }
  .form-submit .primary-button { width: 100%; }
  .stack-form, .stack-form.catalog-import-form, .search-form, .catalog-filter { grid-template-columns: 1fr; }
  .marketplace-panel { min-height: auto; }
  .product-row { grid-template-columns: 56px minmax(0, 1fr) 20px; min-height: 92px; padding: 12px; }
  .product-row .product-thumb { width: 54px; height: 54px; }
  .product-price { grid-column: 2; text-align: left; }
  .product-price del, .product-price strong, .product-price span { display: inline; margin-right: 6px; }
  .row-arrow { grid-column: 3; grid-row: 1 / span 2; }
  .result-card { grid-template-columns: 56px minmax(0, 1fr); }
  .result-card form { grid-column: 1 / -1; }
  .result-card .outline-button { width: 100%; }
  .monitor-form { grid-template-columns: 1fr; }
  .monitor-url, .monitor-affiliate { grid-column: auto; }
  .monitor-form .primary-button { width: 100%; }
  .offer-row { grid-template-columns: 54px minmax(0, 1fr); }
  .offer-row .product-thumb { width: 54px; height: 54px; }
  .offer-row .status-badge { grid-column: 2; justify-self: start; }
  .offer-form { grid-template-columns: 1fr; }
  .group-selector { grid-template-columns: 1fr; }
  .campaign-details { grid-template-columns: 1fr; }
  .log-filters { grid-template-columns: 1fr; }
  .real-chart { gap: 5px; }
  .phase-four-row .offer-review { grid-column: 2; grid-row: auto; justify-items: start; }
  .heading-actions { width: 100%; align-items: stretch; }
  .heading-actions form, .heading-actions .outline-button, .heading-actions .primary-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
