:root {
  --navy: #10173a; --navy2: #1a2350; --blue: #1a6ef5; --cyan: #00b3f0;
  --bg: #f4f7fc; --card: #fff; --text: #10173a; --muted: #5b6482;
  --line: #e3eaf7; --grad: linear-gradient(135deg, #1a6ef5, #00b3f0);
  --green: #0c9d5e; --amber: #b26a00;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Heebo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5;
}

/* ---------- Login ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: radial-gradient(1000px 600px at 70% -10%, #24337a 0%, var(--navy) 60%);
}
.auth-card {
  background: var(--card); border-radius: 20px; padding: 36px 32px; width: 100%;
  max-width: 420px; box-shadow: 0 20px 50px rgba(0,0,0,.35); text-align: center;
}
.auth-card img.logo { width: 190px; max-width: 65%; margin-bottom: 6px; }
.auth-card h1 { font-size: 21px; font-weight: 800; margin-bottom: 4px; }
.auth-card p.sub { font-size: 14px; color: var(--muted); margin-bottom: 22px; }
.field { text-align: right; margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; text-align: left; }
.field input {
  width: 100%; padding: 13px 15px; font-size: 15px; font-family: inherit;
  border: 1.5px solid var(--line); border-radius: 11px; background: #fbfcff; transition: border-color .15s;
}
.field input:focus { outline: none; border-color: var(--blue); background: #fff; }
.btn-primary {
  width: 100%; background: var(--grad); color: #fff; border: none; font-family: inherit;
  font-size: 16px; font-weight: 700; padding: 14px; border-radius: 12px; cursor: pointer;
  box-shadow: 0 6px 18px rgba(26,110,245,.35); transition: filter .15s, transform .1s;
}
.btn-primary:hover { filter: brightness(1.07); transform: translateY(-1px); }
.alert {
  background: #fff1f1; border: 1px solid #f3d0d0; color: #b3261e;
  border-radius: 10px; padding: 11px 14px; font-size: 14px; margin-bottom: 16px;
}
.auth-foot { margin-top: 20px; font-size: 12.5px; color: #9aa3c0; }

/* ---------- Layout do painel ---------- */
header.top {
  background: var(--navy); color: #fff; padding: 16px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
header.top img { width: 132px; }
header.top .who { font-size: 14px; color: #c6d2f2; }
header.top .who b { color: #fff; }
header.top a.out { color: #aebadf; font-size: 13.5px; text-decoration: none; border: 1px solid #34406f; padding: 7px 14px; border-radius: 9px; }
header.top a.out:hover { background: #1b2450; color: #fff; }
main.wrap { max-width: 1080px; margin: 0 auto; padding: 26px 18px 60px; }
h2.sec { font-size: 17px; font-weight: 800; margin: 30px 0 12px; }
h2.sec:first-child { margin-top: 0; }

/* ---------- Cards de métrica ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; }
.stat .lbl { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat .val { font-size: 27px; font-weight: 900; margin-top: 4px; letter-spacing: -.5px; }
.stat.accent { background: var(--grad); border: none; color: #fff; box-shadow: 0 8px 22px rgba(26,110,245,.3); }
.stat.accent .lbl { color: #dbe9ff; }

/* ---------- Bloco do link ---------- */
.linkbox { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.linkrow { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.linkrow input {
  flex: 1; min-width: 240px; padding: 12px 14px; font-size: 14px; font-family: monospace;
  border: 1.5px solid var(--line); border-radius: 10px; background: #f7f9ff; color: var(--navy);
}
.btn {
  background: var(--grad); color: #fff; border: none; font-family: inherit; font-size: 14px;
  font-weight: 700; padding: 12px 20px; border-radius: 10px; cursor: pointer; text-decoration: none;
  display: inline-block; white-space: nowrap;
}
.btn.ghost { background: #fff; color: var(--blue); border: 1.5px solid #cfe0fb; }
.btn.ghost:hover { background: #f2f7ff; }
.btn:hover { filter: brightness(1.06); }
.hint { font-size: 13px; color: var(--muted); margin-top: 12px; line-height: 1.7; }
.qr { display: flex; gap: 18px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.qr img { width: 132px; height: 132px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }

/* ---------- Tabela ---------- */
.tablecard { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px;
     color: var(--muted); font-weight: 700; padding: 12px 14px; background: #f8faff; border-bottom: 1px solid var(--line); }
td { padding: 12px 14px; border-bottom: 1px solid #eef2fa; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; white-space: nowrap; }
td.comm { color: var(--green); font-weight: 700; }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); font-size: 14.5px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
select {
  padding: 10px 13px; font-family: inherit; font-size: 14px; border: 1.5px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--text); cursor: pointer;
}
.pill { font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 999px; display: inline-block; }
.pill.on { background: #e6f7ee; color: var(--green); }
.pill.off { background: #f1f2f7; color: #6b7390; }
.muted { color: var(--muted); font-size: 13px; }
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 12px 22px; border-radius: 999px;
  font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); z-index: 99;
}
.toast.show { opacity: 1; }

/* ---------- Abas ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 2px solid var(--line); margin-bottom: 22px; }
.tabs button {
  background: none; border: none; font-family: inherit; font-size: 14.5px; font-weight: 700;
  color: var(--muted); padding: 12px 16px; cursor: pointer; border-bottom: 3px solid transparent;
  margin-bottom: -2px; border-radius: 8px 8px 0 0; transition: color .15s, background .15s;
}
.tabs button:hover { background: #eef3fc; color: var(--navy); }
.tabs button.active { color: var(--blue); border-bottom-color: var(--blue); }
.tabs button .badge-n {
  background: #c62838; color: #fff; font-size: 11px; font-weight: 900;
  padding: 1px 7px; border-radius: 999px; margin-left: 6px; display: inline-block;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Cartão de mensagem (contraproposta) ---------- */
.msg {
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--blue);
  border-radius: 14px; padding: 18px 20px; margin-bottom: 12px;
}
.msg .hd { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.msg .hd b { font-size: 15.5px; }
.msg .when { font-size: 12.5px; color: var(--muted); }
.msg .body { font-size: 14px; color: var(--muted); margin-top: 8px; line-height: 1.7; }
.msg .prices { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 12px; font-size: 14px; }
.msg .prices .from { color: var(--muted); text-decoration: line-through; }
.msg .prices .to { color: var(--blue); font-weight: 900; font-size: 18px; }
.msg .acts { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.msg .quote {
  background: #f7f9ff; border-radius: 10px; padding: 11px 14px;
  font-size: 14px; margin-top: 10px; font-style: italic; color: var(--navy);
}

/* ---------- Formulário admin ---------- */
.formgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.formgrid .field { margin-bottom: 0; }
@media (max-width: 620px) {
  table { font-size: 13px; }
  th, td { padding: 10px 9px; }
  .hide-sm { display: none; }
}

/* Símbolos oficiais das marcas (Simple Icons) — desenhados em máscara para
   herdarem a cor do texto em qualquer fundo. Nada de emoji: o desenho fica
   idêntico em todo aparelho. */
.brand-ico {
  display: inline-block; width: 1.05em; height: 1.05em;
  vertical-align: -.17em; margin-left: .35em;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-size: contain; mask-size: contain;
}
.brand-ico.wa { -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2024%2024%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M17.472%2014.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94%201.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198%200-.52.074-.792.372-.272.297-1.04%201.016-1.04%202.479%200%201.462%201.065%202.875%201.213%203.074.149.198%202.096%203.2%205.077%204.487.709.306%201.262.489%201.694.625.712.227%201.36.195%201.871.118.571-.085%201.758-.719%202.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421%207.403h-.004a9.87%209.87%200%2001-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86%209.86%200%2001-1.51-5.26c.001-5.45%204.436-9.884%209.888-9.884%202.64%200%205.122%201.03%206.988%202.898a9.825%209.825%200%20012.893%206.994c-.003%205.45-4.437%209.884-9.885%209.884m8.413-18.297A11.815%2011.815%200%200012.05%200C5.495%200%20.16%205.335.157%2011.892c0%202.096.547%204.142%201.588%205.945L.057%2024l6.305-1.654a11.882%2011.882%200%20005.683%201.448h.005c6.554%200%2011.89-5.335%2011.893-11.893a11.821%2011.821%200%2000-3.48-8.413Z%22%2F%3E%3C%2Fsvg%3E"); mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2024%2024%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M17.472%2014.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94%201.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198%200-.52.074-.792.372-.272.297-1.04%201.016-1.04%202.479%200%201.462%201.065%202.875%201.213%203.074.149.198%202.096%203.2%205.077%204.487.709.306%201.262.489%201.694.625.712.227%201.36.195%201.871.118.571-.085%201.758-.719%202.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421%207.403h-.004a9.87%209.87%200%2001-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86%209.86%200%2001-1.51-5.26c.001-5.45%204.436-9.884%209.888-9.884%202.64%200%205.122%201.03%206.988%202.898a9.825%209.825%200%20012.893%206.994c-.003%205.45-4.437%209.884-9.885%209.884m8.413-18.297A11.815%2011.815%200%200012.05%200C5.495%200%20.16%205.335.157%2011.892c0%202.096.547%204.142%201.588%205.945L.057%2024l6.305-1.654a11.882%2011.882%200%20005.683%201.448h.005c6.554%200%2011.89-5.335%2011.893-11.893a11.821%2011.821%200%2000-3.48-8.413Z%22%2F%3E%3C%2Fsvg%3E"); }
.brand-ico.ig { -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2024%2024%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M7.0301.084c-1.2768.0602-2.1487.264-2.911.5634-.7888.3075-1.4575.72-2.1228%201.3877-.6652.6677-1.075%201.3368-1.3802%202.127-.2954.7638-.4956%201.6365-.552%202.914-.0564%201.2775-.0689%201.6882-.0626%204.947.0062%203.2586.0206%203.6671.0825%204.9473.061%201.2765.264%202.1482.5635%202.9107.308.7889.72%201.4573%201.388%202.1228.6679.6655%201.3365%201.0743%202.1285%201.38.7632.295%201.6361.4961%202.9134.552%201.2773.056%201.6884.069%204.9462.0627%203.2578-.0062%203.668-.0207%204.9478-.0814%201.28-.0607%202.147-.2652%202.9098-.5633.7889-.3086%201.4578-.72%202.1228-1.3881.665-.6682%201.0745-1.3378%201.3795-2.1284.2957-.7632.4966-1.636.552-2.9124.056-1.2809.0692-1.6898.063-4.948-.0063-3.2583-.021-3.6668-.0817-4.9465-.0607-1.2797-.264-2.1487-.5633-2.9117-.3084-.7889-.72-1.4568-1.3876-2.1228C21.2982%201.33%2020.628.9208%2019.8378.6165%2019.074.321%2018.2017.1197%2016.9244.0645%2015.6471.0093%2015.236-.005%2011.977.0014%208.718.0076%208.31.0215%207.0301.0839m.1402%2021.6932c-1.17-.0509-1.8053-.2453-2.2287-.408-.5606-.216-.96-.4771-1.3819-.895-.422-.4178-.6811-.8186-.9-1.378-.1644-.4234-.3624-1.058-.4171-2.228-.0595-1.2645-.072-1.6442-.079-4.848-.007-3.2037.0053-3.583.0607-4.848.05-1.169.2456-1.805.408-2.2282.216-.5613.4762-.96.895-1.3816.4188-.4217.8184-.6814%201.3783-.9003.423-.1651%201.0575-.3614%202.227-.4171%201.2655-.06%201.6447-.072%204.848-.079%203.2033-.007%203.5835.005%204.8495.0608%201.169.0508%201.8053.2445%202.228.408.5608.216.96.4754%201.3816.895.4217.4194.6816.8176.9005%201.3787.1653.4217.3617%201.056.4169%202.2263.0602%201.2655.0739%201.645.0796%204.848.0058%203.203-.0055%203.5834-.061%204.848-.051%201.17-.245%201.8055-.408%202.2294-.216.5604-.4763.96-.8954%201.3814-.419.4215-.8181.6811-1.3783.9-.4224.1649-1.0577.3617-2.2262.4174-1.2656.0595-1.6448.072-4.8493.079-3.2045.007-3.5825-.006-4.848-.0608M16.953%205.5864A1.44%201.44%200%201%200%2018.39%204.144a1.44%201.44%200%200%200-1.437%201.4424M5.8385%2012.012c.0067%203.4032%202.7706%206.1557%206.173%206.1493%203.4026-.0065%206.157-2.7701%206.1506-6.1733-.0065-3.4032-2.771-6.1565-6.174-6.1498-3.403.0067-6.156%202.771-6.1496%206.1738M8%2012.0077a4%204%200%201%201%204.008%203.9921A3.9996%203.9996%200%200%201%208%2012.0077%22%2F%3E%3C%2Fsvg%3E"); mask-image: url("data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%2024%2024%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M7.0301.084c-1.2768.0602-2.1487.264-2.911.5634-.7888.3075-1.4575.72-2.1228%201.3877-.6652.6677-1.075%201.3368-1.3802%202.127-.2954.7638-.4956%201.6365-.552%202.914-.0564%201.2775-.0689%201.6882-.0626%204.947.0062%203.2586.0206%203.6671.0825%204.9473.061%201.2765.264%202.1482.5635%202.9107.308.7889.72%201.4573%201.388%202.1228.6679.6655%201.3365%201.0743%202.1285%201.38.7632.295%201.6361.4961%202.9134.552%201.2773.056%201.6884.069%204.9462.0627%203.2578-.0062%203.668-.0207%204.9478-.0814%201.28-.0607%202.147-.2652%202.9098-.5633.7889-.3086%201.4578-.72%202.1228-1.3881.665-.6682%201.0745-1.3378%201.3795-2.1284.2957-.7632.4966-1.636.552-2.9124.056-1.2809.0692-1.6898.063-4.948-.0063-3.2583-.021-3.6668-.0817-4.9465-.0607-1.2797-.264-2.1487-.5633-2.9117-.3084-.7889-.72-1.4568-1.3876-2.1228C21.2982%201.33%2020.628.9208%2019.8378.6165%2019.074.321%2018.2017.1197%2016.9244.0645%2015.6471.0093%2015.236-.005%2011.977.0014%208.718.0076%208.31.0215%207.0301.0839m.1402%2021.6932c-1.17-.0509-1.8053-.2453-2.2287-.408-.5606-.216-.96-.4771-1.3819-.895-.422-.4178-.6811-.8186-.9-1.378-.1644-.4234-.3624-1.058-.4171-2.228-.0595-1.2645-.072-1.6442-.079-4.848-.007-3.2037.0053-3.583.0607-4.848.05-1.169.2456-1.805.408-2.2282.216-.5613.4762-.96.895-1.3816.4188-.4217.8184-.6814%201.3783-.9003.423-.1651%201.0575-.3614%202.227-.4171%201.2655-.06%201.6447-.072%204.848-.079%203.2033-.007%203.5835.005%204.8495.0608%201.169.0508%201.8053.2445%202.228.408.5608.216.96.4754%201.3816.895.4217.4194.6816.8176.9005%201.3787.1653.4217.3617%201.056.4169%202.2263.0602%201.2655.0739%201.645.0796%204.848.0058%203.203-.0055%203.5834-.061%204.848-.051%201.17-.245%201.8055-.408%202.2294-.216.5604-.4763.96-.8954%201.3814-.419.4215-.8181.6811-1.3783.9-.4224.1649-1.0577.3617-2.2262.4174-1.2656.0595-1.6448.072-4.8493.079-3.2045.007-3.5825-.006-4.848-.0608M16.953%205.5864A1.44%201.44%200%201%200%2018.39%204.144a1.44%201.44%200%200%200-1.437%201.4424M5.8385%2012.012c.0067%203.4032%202.7706%206.1557%206.173%206.1493%203.4026-.0065%206.157-2.7701%206.1506-6.1733-.0065-3.4032-2.771-6.1565-6.174-6.1498-3.403.0067-6.156%202.771-6.1496%206.1738M8%2012.0077a4%204%200%201%201%204.008%203.9921A3.9996%203.9996%200%200%201%208%2012.0077%22%2F%3E%3C%2Fsvg%3E"); }

/* ---------------------------------------------------------------------------
   Área do afiliado — hebraico, da direita para a esquerda.
   Só vale onde dir="rtl": o painel do Nathan e o do fornecedor seguem em
   português, da esquerda para a direita.
--------------------------------------------------------------------------- */
[dir="rtl"] body,
body[dir="rtl"] { direction: rtl; }
[dir="rtl"] .field { text-align: right; }
[dir="rtl"] .field label { text-align: right; }
[dir="rtl"] th { text-align: right; }
[dir="rtl"] td.num, [dir="rtl"] th.num { text-align: left; }
[dir="rtl"] .badge { margin-left: 0; margin-right: 6px; }
[dir="rtl"] .brand-ico { margin-left: 0; margin-right: .35em; }
[dir="rtl"] .toast { left: auto; right: 50%; transform: translateX(50%); }
[dir="rtl"] .steps li { padding-left: 0; padding-right: 34px; }
[dir="rtl"] .steps li::before { left: auto; right: 0; }
[dir="rtl"] input, [dir="rtl"] textarea, [dir="rtl"] select { text-align: right; }
/* código do afiliado, link e valores são sempre da esquerda para a direita */
[dir="rtl"] input#code, [dir="rtl"] input#f-code, [dir="rtl"] input#link,
[dir="rtl"] input[type="email"], [dir="rtl"] code { direction: ltr; text-align: left; }
