:root {
  --surface-1: #fcfcfb;
  --page: #f9f9f7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --muted: #898781;
  --border: rgba(11,11,11,0.10);
  --gridline: #e1e0d9;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --good: #0ca30c;
  --critical: #d03b3b;
  --warning: #fab219;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--text-primary);
}

a { color: var(--series-1); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.brand { font-weight: 700; color: var(--text-primary); }
.brand span { font-weight: 400; color: var(--text-secondary); }
.nav { display: flex; gap: 16px; flex: 1; flex-wrap: wrap; }
.nav a { color: var(--text-secondary); font-size: 14px; padding: 6px 0; border-bottom: 2px solid transparent; }
.nav a.active { color: var(--text-primary); border-bottom-color: var(--series-1); }
.logout-form { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.user-name { font-size: 13px; color: var(--muted); }
.link-btn { background: none; border: none; color: var(--series-1); cursor: pointer; font-size: 13px; padding: 0; }

.container { max-width: 1100px; margin: 0 auto; padding: 28px 20px 60px; }

.messages { margin-bottom: 20px; }
.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 8px; font-size: 14px; }
.alert-success { background: #e6f6e6; color: #0a5c0a; }
.alert-error { background: #fbe9e8; color: #7a1f1f; }

h1 { font-size: 22px; margin: 0 0 20px; }
h2 { font-size: 16px; color: var(--text-secondary); margin: 0 0 12px; }

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: 2fr 1fr; }
@media (max-width: 860px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .grid-4, .grid-3 { grid-template-columns: 1fr; }
}

.client-card { display: flex; flex-direction: column; gap: 10px; }
.client-card.active { border-color: var(--series-1); box-shadow: 0 0 0 1px var(--series-1); }
.client-card h3 { margin: 0; font-size: 16px; }
.client-card .client-meta { font-size: 13px; color: var(--text-secondary); display: flex; flex-direction: column; gap: 4px; }
.client-card form { margin-top: auto; }
.client-card .btn { width: 100%; text-align: center; }

.stat-tile { padding: 18px; }
.stat-tile .label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.stat-tile .value { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-tile .sub { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--gridline); }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; }
.badge-warning { background: #fff3d6; color: #8a5a00; }
.badge-critical { background: #fbe9e8; color: #7a1f1f; }
.badge-good { background: #e6f6e6; color: #0a5c0a; }

.btn {
  display: inline-block;
  background: var(--series-1);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
.btn:hover { opacity: .92; text-decoration: none; }
.btn-secondary { background: transparent; color: var(--text-primary); border: 1px solid var(--border); }
.btn-danger { background: var(--critical); }

.input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
}
label { font-size: 13px; color: var(--text-secondary); display: block; margin: 14px 0 6px; }
.field-row { margin-bottom: 4px; }
.form-actions { margin-top: 22px; display: flex; gap: 10px; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }

.store-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid var(--gridline); }
.store-tab { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; font-size: 13px; color: var(--text-secondary); border-bottom: 2px solid transparent; }
.store-tab:hover { text-decoration: none; color: var(--text-primary); }
.store-tab.active { color: var(--text-primary); font-weight: 600; border-bottom-color: var(--series-1); }
.store-tab-marketplace { color: var(--muted); font-weight: 400; }
.store-tab-count { background: var(--gridline); color: var(--text-secondary); border-radius: 10px; padding: 1px 7px; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.store-tab.active .store-tab-count { background: var(--series-1); color: #fff; }

.login-wrap { max-width: 380px; margin: 90px auto; }
.login-wrap h1 { text-align: center; }

.progress-bar { height: 8px; border-radius: 6px; background: var(--gridline); overflow: hidden; margin-top: 8px; }
.progress-bar-fill { height: 100%; background: var(--series-1); }

/* Tabela de preços no formato da planilha: usa a largura toda da tela,
   rola na horizontal e mantém o nome do produto fixo à esquerda. */
.sheet-wrap {
  width: calc(100vw - 40px);
  margin-left: calc(50% - 50vw + 20px);
  overflow-x: auto;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
table.sheet { width: auto; min-width: 100%; font-size: 12px; }
table.sheet th, table.sheet td { padding: 5px 8px; white-space: nowrap; border-bottom: 1px solid var(--gridline); border-right: 1px solid var(--gridline); }
table.sheet thead th { font-size: 11px; text-transform: none; letter-spacing: 0; color: var(--text-primary); background: #f1f0ec; white-space: normal; vertical-align: bottom; min-width: 64px; }
table.sheet tr.sheet-groups th { text-align: center; font-weight: 700; font-size: 12px; color: #fff; }
table.sheet th.g-basic { background: #3b3b3b; }
table.sheet th.g-profit { background: #3f8f4f; }
table.sheet th.g-fees { background: #5c9b6a; }
table.sheet th.g-mkt { background: #2f7a45; }
table.sheet th.g-curve { background: #1f6135; }
table.sheet tbody tr:hover td { background: #f4f7fb; }
table.sheet .sheet-name { position: sticky; left: 0; background: var(--surface-1); z-index: 1; min-width: 200px; max-width: 320px; white-space: normal; }
table.sheet thead .sheet-name { background: #f1f0ec; }
table.sheet td.margin-loss { background: #e8433a; color: #fff; font-weight: 600; }
table.sheet td.margin-low { background: #ffe45c; color: #3a3000; font-weight: 600; }
table.sheet td.margin-ok { background: #4cb963; color: #fff; font-weight: 600; }
table.sheet tbody tr:hover td.margin-loss { background: #d63a31; }
table.sheet tbody tr:hover td.margin-low { background: #f5d940; }
table.sheet tbody tr:hover td.margin-ok { background: #3fa955; }
table.sheet td.sheet-incomplete { background: #fff3d6; color: #8a5a00; font-weight: 600; text-align: center; }
table.sheet td.sheet-muted { color: var(--muted); text-align: center; }
table.sheet tr.sheet-inactive td { color: var(--muted); }

.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 18px; }
@media (max-width: 860px) { .form-grid { grid-template-columns: 1fr; } }
.form-section { margin-bottom: 18px; }
.form-section h2 { margin: 0 0 4px; }
.field-error { color: var(--critical); font-size: 12px; margin-top: 4px; }
.field-help { color: var(--muted); font-size: 12px; margin-top: 4px; }
table.sheet td.sheet-edit { padding: 2px 4px; }
table.sheet .pct-input { width: 62px; padding: 3px 4px; border: 1px solid var(--gridline); border-radius: 4px; font-size: 12px; text-align: right; background: #fffdf2; font-variant-numeric: tabular-nums; }
table.sheet .pct-input:focus { outline: 2px solid var(--series-1); border-color: transparent; }
table.sheet .pct-input::placeholder { color: #9a988f; }

/* Dashboard de vendas (relatório Vendas por variante do Upseller) */
.share-row { margin-bottom: 12px; }
.share-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-secondary); }
.abc { display: inline-block; width: 22px; text-align: center; border-radius: 4px; font-weight: 700; font-size: 12px; color: #fff; }
.abc-A { background: #1f6135; }
.abc-B { background: #d99a00; }
.abc-C { background: #8a8880; }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 160px; padding-top: 8px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; text-decoration: none; }
.bar:hover { text-decoration: none; }
.bar-fill { width: 100%; max-width: 48px; background: #9dbfe8; border-radius: 4px 4px 0 0; min-height: 2px; }
.bar.active .bar-fill { background: var(--series-1); }
.bar-label { font-size: 11px; color: var(--muted); margin-top: 4px; }
