/* ============================================================
 * portal.css — portal do afiliado (ficha N, PR C)
 * Base: mockups 01–06 aprovados pelo dono. Fonte Inter vendorizada
 * (fontes/OFL.txt), sem CDN.
 * ============================================================ */
@font-face {
  font-family: Inter;
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fontes/inter-latin-wght.woff2") format("woff2-variations");
}
:root {
  --brand: #1657b8;
  --brand-dark: #0b3d82;
  --teal: #3fd3cb;
  --ink: #0b2340;
  --muted: #64748b;
  --line: #e5e7eb;
  --fill: #f0f5fb;
  --page: #f4f6f9;
  --ok: #059669;
  --warn: #d97706;
  --danger: #dc2626;
  --card-shadow: 0 18px 50px rgba(11, 35, 64, 0.10), 0 2px 8px rgba(11, 35, 64, 0.04);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background-color: var(--page);
  background-image: radial-gradient(rgba(15, 23, 42, 0.09) 1px, transparent 1px);
  background-size: 18px 18px;
  min-height: 100%;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.card {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  border: 1px solid #e8ecf1;
  overflow: hidden;
}
.card-accent {
  height: 5px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand) 72%, var(--teal) 100%);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--brand); color: #fff; border: none; border-radius: 10px;
  padding: 12px 18px; font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; color: #fff; }
.btn.secondary {
  background: #fff; color: var(--brand); border: 1px solid #c7d2e5;
}
.btn.secondary:hover { background: var(--fill); color: var(--brand-dark); }
.btn.ghost { background: transparent; color: var(--brand); border: none; padding: 8px 10px; }
.btn.sm { padding: 8px 12px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: #334155; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid #d8dee8; background: var(--fill); border-radius: 10px;
  padding: 11px 14px; font-size: 14px; font-family: inherit; color: var(--ink); outline: none;
}
.field textarea { min-height: 80px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(22, 87, 184, 0.15);
}
.field .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.check-item {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: #334155;
  background: var(--fill); border: 1px solid #e2e8f0; border-radius: 999px; padding: 7px 12px;
}
.check-item input { accent-color: var(--brand); }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
}
.badge.ok { background: #d1fae5; color: #065f46; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.info { background: #dbeafe; color: #1e40af; }
.badge.muted { background: #e2e8f0; color: #475569; }
.badge.danger { background: #fee2e2; color: #991b1b; }
.badge.teal { background: #ccfbf1; color: #0f766e; }

/* Landing */
.landing-wrap {
  max-width: 960px; margin: 0 auto; padding: 36px 20px 48px;
}
.landing-hero {
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 28px; align-items: stretch;
}
.hero-copy { padding: 8px 4px; }
.brand-top { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.brand-top img, .brand-top svg { height: 42px; width: auto; }
.brand-top .portal-label {
  font-size: 12px; font-weight: 600; color: var(--brand); background: #e8f0fb;
  border-radius: 999px; padding: 4px 10px;
}
.hero-copy h1 {
  margin: 0 0 12px; font-size: 32px; line-height: 1.2; letter-spacing: -0.03em; color: var(--ink);
}
.hero-copy .lead { margin: 0 0 22px; font-size: 16px; color: var(--muted); line-height: 1.55; }
.benefits { list-style: none; padding: 0; margin: 0 0 28px; display: grid; gap: 10px; }
.benefits li {
  display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: #334155; line-height: 1.45;
}
.benefits li::before {
  content: ""; flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--teal));
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/%3E%3C/svg%3E") center/14px no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/%3E%3C/svg%3E") center/14px no-repeat;
  background-color: var(--brand);
}
.hero-card .card-body { padding: 26px 28px 28px; }
.hero-card h2 { margin: 0 0 6px; font-size: 20px; }
.hero-card .subtitle { margin: 0 0 18px; font-size: 13px; color: var(--muted); }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.footer-note {
  text-align: center; color: #94a3b8; font-size: 12px; margin-top: 28px; line-height: 1.5;
}
.rules {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 28px;
}
.rule {
  background: #fff; border: 1px solid #e8ecf1; border-radius: 14px; padding: 16px 18px;
  box-shadow: 0 2px 8px rgba(11,35,64,.04);
}
.rule h3 { margin: 0 0 6px; font-size: 14px; color: var(--ink); }
.rule p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.45; }

/* Centered form pages */
.center-page {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100%; padding: 28px 16px 36px;
}
.center-page .card { width: 100%; max-width: 520px; }
.center-page .card.wide { max-width: 640px; }
.card-body { padding: 28px 32px 30px; }
.brand { display: flex; justify-content: center; margin: 4px 0 14px; }
.brand svg, .brand img { width: 100%; max-width: 260px; height: auto; display: block; }
.card-body h1 { margin: 0 0 6px; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.card-body .subtitle { margin: 0 0 20px; font-size: 14px; color: var(--muted); line-height: 1.45; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.status-box {
  text-align: center; padding: 12px 8px 4px;
}
.status-icon {
  width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%;
  background: #fef3c7; color: #d97706; display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}
.status-box p { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0 0 8px; }

/* Portal shell (logged-in) */
.portal-shell { min-height: 100%; display: flex; flex-direction: column; }
.portal-top {
  background: #fff; border-bottom: 1px solid #e8ecf1;
  padding: 0 24px; height: 60px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 20;
}
.portal-top .left { display: flex; align-items: center; gap: 14px; }
.portal-top .logo-sm { height: 32px; width: auto; }
.portal-top .nav { display: flex; gap: 4px; }
.portal-top .nav a {
  color: #475569; font-size: 13px; font-weight: 500; padding: 8px 12px; border-radius: 8px;
  text-decoration: none;
}
.portal-top .nav a:hover { background: var(--fill); color: var(--brand); text-decoration: none; }
.portal-top .nav a.on { background: #e8f0fb; color: var(--brand); font-weight: 600; }
.portal-top .user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #475569; }
.portal-top .avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px;
}
.portal-main { flex: 1; max-width: 1100px; width: 100%; margin: 0 auto; padding: 24px 20px 48px; }
.portal-main h1 { margin: 0 0 4px; font-size: 24px; letter-spacing: -0.02em; }
.portal-main .page-sub { margin: 0 0 22px; color: var(--muted); font-size: 14px; }
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpis.tres { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi {
  background: #fff; border: 1px solid #e8ecf1; border-radius: 14px; padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(11,35,64,.04);
}
.kpi .label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 22px; font-weight: 700; color: var(--ink); margin-top: 4px; letter-spacing: -0.02em; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.link-box {
  background: #fff; border: 1px solid #e8ecf1; border-radius: 14px; padding: 16px 18px;
  display: flex; gap: 16px; align-items: center; margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(11,35,64,.04);
}
.link-box .url {
  flex: 1; font-family: ui-monospace, Consolas, monospace; font-size: 13px;
  background: var(--fill); border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px 12px;
  color: var(--ink); word-break: break-all;
}
.qr {
  width: 72px; height: 72px; flex: none; border-radius: 8px; background: #fff;
  border: 1px solid #e2e8f0; padding: 4px;
}
.qr svg { display: block; width: 100%; height: 100%; }
.table-card {
  background: #fff; border: 1px solid #e8ecf1; border-radius: 14px; overflow: hidden;
  box-shadow: 0 2px 8px rgba(11,35,64,.04);
}
.table-card .th { padding: 14px 18px; border-bottom: 1px solid #eef2f7; display: flex; justify-content: space-between; align-items: center; }
.table-card .th h2 { margin: 0; font-size: 15px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: 10px 16px; border-bottom: 1px solid #eef2f7; font-weight: 600;
  background: #f8fafc;
}
table.data td { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; color: #334155; vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.mats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.mat {
  background: #fff; border: 1px solid #e8ecf1; border-radius: 14px; overflow: hidden;
  box-shadow: 0 2px 8px rgba(11,35,64,.04);
}
.mat-preview {
  height: 120px; background: linear-gradient(135deg, #1657b8 0%, #0b3d82 60%, #3fd3cb 100%);
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700;
  font-size: 14px; text-align: center; padding: 12px;
}
.mat-preview.alt { background: linear-gradient(135deg, #0b2340, #1657b8); }
.mat-preview.story { height: 180px; }
.mat-body { padding: 14px 16px 16px; }
.mat-body h3 { margin: 0 0 4px; font-size: 14px; }
.mat-body p { margin: 0 0 12px; font-size: 12px; color: var(--muted); line-height: 1.4; }
.text-snip {
  background: var(--fill); border: 1px dashed #cbd5e1; border-radius: 10px; padding: 12px;
  font-size: 13px; color: #334155; line-height: 1.45; margin-bottom: 10px;
}
/* Estados do portal (não estão nos mockups como tela própria) */
[hidden] { display: none !important; }
.aviso {
  display: flex; gap: 10px; align-items: flex-start;
  background: #fef3c7; border: 1px solid #fcd34d; color: #92400e;
  border-radius: 12px; padding: 12px 16px; margin-bottom: 20px; font-size: 13px; line-height: 1.5;
}
.aviso strong { color: #78350f; }
.erro-form {
  background: #fee2e2; border: 1px solid #fecaca; color: #991b1b;
  border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px;
}
.status-icon.danger { background: #fee2e2; color: var(--danger); }
.vazio { padding: 28px 18px; text-align: center; color: var(--muted); font-size: 13px; }
.mat-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: #fff; font-size: 13px; padding: 10px 16px; border-radius: 10px;
  box-shadow: var(--card-shadow);
}
.pix-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin: -8px 0 20px; }
.pix-form .field { margin: 0; min-width: 180px; flex: 1; }
.btn[disabled] { opacity: .55; cursor: default; }
.portal-top .sair { font-size: 12px; color: var(--muted); background: none; border: none; cursor: pointer; font-family: inherit; }
.portal-top .sair:hover { color: var(--brand); }
.termos-texto {
  white-space: pre-wrap; background: var(--fill); border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 12px; font-size: 12px; color: #334155; max-height: 220px; overflow: auto; margin: -8px 0 16px;
}
table.data .nowrap { white-space: nowrap; }
.table-scroll { overflow-x: auto; }

@media (max-width: 900px) {
  .landing-hero { grid-template-columns: 1fr; }
  .rules { grid-template-columns: 1fr; }
  .kpis, .kpis.tres { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mats { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .portal-top { padding: 0 12px; height: auto; flex-wrap: wrap; gap: 8px; padding-top: 10px; padding-bottom: 10px; }
  /* logo e abas numa linha (as abas rolam de lado); nome, % e Sair na de baixo */
  .portal-top .left { width: 100%; min-width: 0; }
  .portal-top .nav { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .portal-top .nav a { white-space: nowrap; flex: none; }
  .portal-top .user { flex-wrap: wrap; min-width: 0; }
  .link-box { flex-direction: column; align-items: stretch; }
}
@media (max-width: 640px) {
  .kpi .value { overflow-wrap: anywhere; }
  /* tabela rola dentro do card; a página não rola de lado */
  table.data th, table.data td { padding: 10px 12px; }
  table.data th { white-space: nowrap; }
}
@media (max-width: 400px) {
  .kpi .value { font-size: 19px; }
}
