/*
 * painel.css — Estilos do sistema TedPay (auth + admin + franqueado)
 * Segue a identidade visual: amarelo #FFCC00 + preto, fonte Poppins.
 */

:root {
  --yellow:        #FFCC00;
  --yellow-dark:   #F2BD00;
  --yellow-darker: #E0AC00;
  --yellow-light:  #FFF4B8;
  --yellow-50:     #FFFBE5;

  --black:    #0A0A0A;
  --ink:      #1A1A1A;
  --gray-900: #2A2A2A;
  --gray-700: #4A4A4A;
  --gray-500: #7A7A7A;
  --gray-300: #C8C8C8;
  --gray-100: #EDEDED;
  --gray-50:  #F7F7F7;
  --white:    #FFFFFF;

  --success: #00B86B;
  --danger:  #E74C3C;

  --radius:    20px;
  --radius-sm: 12px;
  --radius-lg: 28px;

  --shadow-sm:     0 2px 8px rgba(0,0,0,0.04);
  --shadow-md:     0 10px 32px rgba(0,0,0,0.08);
  --shadow-lg:     0 24px 60px rgba(0,0,0,0.12);
  --shadow-yellow: 0 12px 32px rgba(255,204,0,0.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Poppins', system-ui, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* =========================================================
   AUTH (login / cadastro)
   ========================================================= */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(255,204,0,.18), transparent 60%),
    linear-gradient(135deg, var(--black) 0%, var(--gray-900) 100%);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 40px 34px;
  box-shadow: var(--shadow-lg);
}
.auth-card.wide { max-width: 540px; }

.auth-logo {
  display: block;
  height: 38px;
  width: auto;
  margin: 0 auto 6px;
}

.auth-subtitle {
  text-align: center;
  color: var(--gray-500);
  font-size: 14px;
  margin-bottom: 28px;
}

.auth-card label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.field { margin-bottom: 18px; }
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }

.auth-card input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  background: var(--gray-50);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.auth-card select,
.auth-card textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  background: var(--gray-50);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.auth-card textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.auth-card select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 40px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237A7A7A' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
.auth-card input::placeholder,
.auth-card textarea::placeholder { color: var(--gray-500); }
.auth-card input:hover,
.auth-card select:hover,
.auth-card textarea:hover { border-color: var(--gray-500); }
.auth-card input:focus,
.auth-card select:focus,
.auth-card textarea:focus {
  outline: none;
  border-color: var(--yellow);
  background: var(--white);
  box-shadow: 0 0 0 3px var(--yellow-50);
}
.auth-section {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin: 26px 0 14px;
  padding-top: 18px;
  border-top: 1px solid var(--gray-100);
}

/* Botão padrão da marca: amarelo + texto preto, hover preto */
.btn-brand {
  width: 100%;
  padding: 13px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--yellow);
  color: var(--black);
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  margin-top: 6px;
  transition: background .2s, color .2s, transform .15s, box-shadow .2s;
}
.btn-brand:hover {
  background: var(--black);
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: var(--shadow-yellow);
}

/* Checkbox de aceite dos termos */
.terms-accept {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 8px 0 18px;
  font-size: 13px;
  color: var(--gray-700);
  line-height: 1.5;
  cursor: pointer;
}
.terms-accept input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  flex: 0 0 auto;
  accent-color: var(--yellow-darker);
  cursor: pointer;
}
.terms-accept a { color: var(--yellow-darker); font-weight: 700; text-decoration: underline; }

.auth-foot {
  text-align: center;
  margin-top: 22px;
  font-size: 13px;
  color: var(--gray-500);
}
.auth-foot a { color: var(--yellow-darker); text-decoration: none; font-weight: 600; }
.auth-foot a:hover { text-decoration: underline; }

.msg {
  font-size: 13px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
}
.msg.error   { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.msg.success { background: var(--yellow-50); border: 1px solid var(--yellow-light); color: var(--gray-900); }

/* =========================================================
   ADMIN (layout com sidebar)
   ========================================================= */
.layout { display: flex; min-height: 100vh; background: var(--gray-50); }

.sidebar {
  width: 234px;
  background: var(--yellow);
  color: var(--black);
  display: flex;
  flex-direction: column;
  padding: 22px 0;
  position: sticky;
  top: 0;
  height: 100vh;
  align-self: flex-start;
  overflow-y: auto;
}
.sidebar .brand { padding: 0 22px 22px; }
.sidebar .brand img {
  height: 26px; width: auto;
  filter: brightness(0); /* logo sempre preto sobre o amarelo */
}
.sidebar .nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 22px;
  color: var(--black);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s;
}
.sidebar a svg {
  width: 18px; height: 18px;
  flex: 0 0 auto;
  stroke: currentColor;
}
.sidebar a i {
  width: 20px;
  flex: 0 0 auto;
  text-align: center;
  font-size: 15px;
}
.sidebar a:hover { background: var(--yellow-dark); color: var(--black); }
.sidebar a.active {
  background: var(--yellow-dark);
  color: var(--black);
  border-left-color: var(--black);
}
.sidebar .spacer { flex: 1; min-height: 16px; }
.sidebar .logout {
  color: #9b1c1c;
  margin-top: 8px;
  border-top: 1px solid var(--yellow-dark);
  padding-top: 16px;
}
.sidebar .logout:hover { background: var(--yellow-dark); color: #7f1212; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-100);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar h1 { font-size: 18px; font-weight: 700; color: var(--ink); }
.topbar .who { font-size: 13px; color: var(--gray-500); }
.main { padding: 28px; }

.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; }
.flash.success { background: var(--yellow-50); border: 1px solid var(--yellow-light); color: var(--gray-900); }
.flash.error   { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.flash.info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }

.readonly-note { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.readonly-note i { flex: none; }
form.is-readonly { opacity: .85; }
/* Fieldset usado para travar (somente leitura) blocos de formulário sem alterar o layout */
.perm-lock { border: 0; padding: 0; margin: 0; min-width: 0; }

/* Tela de Acessos: grade de permissões (telas + ações) */
.perm-heading { font-size: 14px; margin: 18px 0 10px; color: var(--gray-700, #374151); }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.perm-screen { border: 1px solid var(--gray-200, #e5e7eb); border-radius: 10px; padding: 12px 14px; background: var(--gray-50, #f9fafb); }
.perm-view { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; cursor: pointer; }
.perm-view input { width: 16px; height: 16px; }
.perm-actions { margin: 10px 0 0 26px; display: flex; flex-direction: column; gap: 7px; }
.perm-actions label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--gray-700, #374151); cursor: pointer; }
.access-item { border: 1px solid var(--gray-200, #e5e7eb); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.access-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.access-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.reset-pass-form { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--gray-200, #e5e7eb); max-width: 420px; }form.is-readonly button,
form.is-readonly input,
form.is-readonly select,
form.is-readonly textarea { cursor: not-allowed; }
form.is-readonly button:disabled,
form.is-readonly input[type="submit"]:disabled { opacity: .5; filter: grayscale(0.5); box-shadow: none; }

.card {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-sm);
  padding: 22px;
  margin-bottom: 20px;
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--gray-100); }
th { color: var(--gray-500); font-weight: 600; font-size: 12px; text-transform: uppercase; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.pending  { background: var(--yellow-light); color: var(--yellow-darker); }
.badge.active   { background: #dcfce7; color: #166534; }
.badge.rejected { background: #fee2e2; color: #991b1b; }

.btn {
  border: 0;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  display: inline-block;
  transition: background .15s, color .15s;
}
.btn.approve { background: var(--yellow); color: var(--black); }
.btn.approve:hover { background: var(--black); color: var(--white); }
.btn.reject  { background: var(--white); color: var(--danger); border: 1px solid #fecaca; }
.btn.reject:hover { background: #fef2f2; }

.empty { color: var(--gray-500); text-align: center; padding: 40px 0; }
.inline-form { display: inline; }

/* Paginação de tabelas */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin-top: 18px;
}
.pagination .page-item {
  padding: 8px 14px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; text-decoration: none;
  color: var(--ink); border: 1px solid var(--gray-100); background: var(--white);
  transition: border-color .15s, color .15s;
}
.pagination a.page-item:hover { border-color: var(--yellow); color: var(--yellow-darker); }
.pagination .page-item.disabled { color: var(--gray-300); border-color: var(--gray-50); cursor: default; }
.pagination .page-info { font-size: 13px; color: var(--gray-500); }

/* Card title + link de afiliado */
.card-title { font-size: 16px; font-weight: 700; color: var(--ink); margin: 0 0 6px; }

.copy-row { display: flex; gap: 10px; margin-bottom: 16px; }
.copy-row input {
  flex: 1;
  padding: 12px 14px;
  border: 1.5px solid var(--gray-100);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--gray-700);
  background: var(--gray-50);
}
.copy-row input:focus { outline: none; border-color: var(--yellow); }

.share-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.share-btn {
  background: #25D366; color: var(--white);
  padding: 10px 18px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 700; text-decoration: none;
  transition: filter .15s;
}
.share-btn:hover { filter: brightness(0.95); }
.share-link { color: var(--yellow-darker); font-weight: 600; text-decoration: none; font-size: 14px; }
.share-link:hover { text-decoration: underline; }

/* Links por produto e desconto (painel franqueado) */
.product-group-title {
  font-size: 14px; font-weight: 800; color: var(--ink);
  margin: 18px 0 10px; padding-bottom: 6px;
  border-bottom: 1px solid var(--gray-100);
}
.product-link-row { margin-bottom: 12px; }
.product-link-name {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--gray-700); margin-bottom: 6px;
}

/* Seletor de cupom */
.coupon-picker { margin-bottom: 18px; }
.coupon-picker label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--gray-700); margin-bottom: 6px;
}
.coupon-picker select {
  width: 100%; max-width: 320px;
  padding: 10px 12px; font-size: 14px; font-family: inherit; color: var(--ink);
  border: 1.5px solid var(--gray-100); border-radius: var(--radius-sm); background: var(--white);
}
.coupon-picker select:focus { outline: none; border-color: var(--yellow); }

/* Barra de filtros (telas de produtos e vendas) */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end;
}
.filter-bar .field { display: flex; flex-direction: column; gap: 7px; }
.filter-bar .field > label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--gray-500);
}
.filter-bar input,
.filter-bar select {
  height: 44px;
  padding: 0 14px;
  font-size: 14px; font-family: inherit; color: var(--ink);
  border: 1.5px solid var(--gray-100); border-radius: var(--radius-sm);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
}
.filter-bar select {
  min-width: 190px;
  padding-right: 40px;
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236b7280' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  cursor: pointer;
}
.filter-bar input:hover,
.filter-bar select:hover { border-color: var(--gray-300); }
.filter-bar input:focus,
.filter-bar select:focus {
  outline: none; border-color: var(--yellow);
  box-shadow: 0 0 0 3px rgba(255, 204, 0, .18);
}
.filter-bar .actions { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.filter-bar .btn { height: 44px; padding: 0 26px; }
@media (max-width: 720px) {
  .filter-bar .field { flex: 1 1 100%; }
  .filter-bar .field input,
  .filter-bar .field select { width: 100%; }
  .filter-bar .actions { margin-left: 0; width: 100%; justify-content: flex-end; }
}

/* Tabs Plus / Max */
.tabs {
  display: flex; gap: 6px; margin-bottom: 18px;
  border-bottom: 1px solid var(--gray-100);
}
.tab {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  padding: 10px 18px; font-family: inherit; font-size: 14px; font-weight: 700;
  color: var(--gray-500); border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--yellow); }

.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* URL maior, botão copiar menor */
.product-link-row .copy-row { align-items: stretch; gap: 8px; }
.product-link-row .copy-row input { flex: 1 1 auto; min-width: 0; }
.product-link-row .btn-copy {
  flex: 0 0 auto; width: auto; margin-top: 0;
  padding: 0 18px; font-size: 13px; white-space: nowrap;
}
.product-link-row .share-btn {
  flex: 0 0 auto; display: inline-flex; align-items: center;
  padding: 0 16px; white-space: nowrap;
}

/* Link em linha de tabela (detalhe do franqueado) */
.row-link { color: var(--ink); font-weight: 600; text-decoration: none; }
.row-link:hover { color: var(--yellow-darker); text-decoration: underline; }

/* Detalhe do franqueado */
.detail-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  background: var(--white); border: 1px solid var(--gray-100);
  border-radius: var(--radius-sm); padding: 22px;
}
.detail-head > div { min-width: 0; }
.detail-head .muted { overflow-wrap: anywhere; }
.kv dd { overflow-wrap: anywhere; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; margin: 0; font-size: 14px; }
.kv dt { color: var(--gray-500); }
.kv dd { margin: 0; color: var(--ink); }
@media (max-width: 720px) { .detail-grid { grid-template-columns: 1fr; } }

/* Botão que parece link (abre modal a partir de uma tabela) */
.link-btn {
  border: 0; background: none; padding: 0; font: inherit; cursor: pointer; text-align: left;
}

/* Modal (dados do cadastro pendente) */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(10,10,10,.55);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; overflow-y: auto;
}
.modal-overlay[hidden] { display: none; }
.modal {
  position: relative; width: 100%; max-width: 520px;
  background: var(--white); border-radius: var(--radius);
  padding: 28px 28px 24px; box-shadow: var(--shadow-lg);
  max-height: 90vh; overflow-y: auto;
}
.modal-title { font-size: 14px; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 6px; }
.modal .kv { grid-template-columns: 150px 1fr; gap: 10px 14px; }
.modal .kv dd { white-space: pre-wrap; word-break: break-word; }
.modal-close {
  position: absolute; top: 14px; right: 16px;
  border: 0; background: none; font-size: 26px; line-height: 1;
  color: var(--gray-500); cursor: pointer;
}
.modal-close:hover { color: var(--ink); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 22px; }
.modal-actions .btn { text-decoration: none; }
@media (max-width: 560px) { .modal .kv { grid-template-columns: 1fr; gap: 2px 0; } .modal .kv dt { margin-top: 10px; } }

/* Formulário de edição do cadastro */
.edit-form label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 12px; }
.edit-form input, .edit-form select, .edit-form textarea {
  display: block; width: 100%; margin-top: 5px;
  padding: 10px 12px; font-size: 14px; font-family: inherit; color: var(--ink);
  border: 1.5px solid var(--gray-100); border-radius: var(--radius-sm); background: var(--white);
}
.edit-form textarea { resize: vertical; min-height: 64px; line-height: 1.5; }
.edit-form input:focus, .edit-form select:focus, .edit-form textarea:focus { outline: none; border-color: var(--yellow); }
.edit-form .form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.edit-form .form-row label { flex: 1; min-width: 120px; }

/* Banner "valor a pagar" no detalhe do franqueado */
.pay-banner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  background: var(--black); color: var(--white);
  border-radius: var(--radius-sm); padding: 22px 26px; margin: 20px 0;
}
.pay-banner-label { font-size: 14px; font-weight: 600; color: var(--yellow); }
.pay-banner-sub { font-size: 12px; color: var(--gray-300); margin-top: 2px; }
.pay-banner-value { font-size: 32px; font-weight: 900; color: var(--white); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; }
.kpi {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-sm);
  padding: 20px;
  transition: box-shadow .15s, transform .15s;
}
a.kpi:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kpi .n { font-size: 28px; font-weight: 800; color: var(--black); }
.kpi .l { font-size: 13px; color: var(--gray-500); margin-top: 4px; }

/* Dashboard admin — empilhamento com espaçamento uniforme entre cards */
.dash-stack { display: flex; flex-direction: column; gap: 20px; }
.dash-stack > .card,
.dash-stack > .kpis,
.dash-stack > .dash-cols { margin: 0; }
.dash-stack .card { margin-bottom: 0; }

/* Cabeçalho de card (título + ação/legenda) */
.dash-card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 4px;
}
.dash-card-head h2 { font-size: 16px; margin: 0; }
.dash-card-sub { font-size: 13px; color: var(--gray-500); margin: 0 0 18px; }

/* Grade de duas colunas */
.dash-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.dash-cols > .card { margin-bottom: 0; }

/* Gráfico de barras verticais */
.dash-chart {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  min-height: 170px;
  padding-top: 10px;
}
.dash-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}
.dash-bar {
  width: 100%;
  max-width: 54px;
  background: linear-gradient(180deg, var(--yellow) 0%, var(--yellow-darker) 100%);
  border-radius: 8px 8px 0 0;
  transition: filter .15s;
}
.dash-bar.alt {
  background: linear-gradient(180deg, #2b2b2b 0%, #000 100%);
}
.dash-bar-col:hover .dash-bar { filter: brightness(0.92); }
.dash-bar-value { font-size: 11px; font-weight: 700; color: var(--gray-700); white-space: nowrap; }
.dash-bar-label { font-size: 12px; color: var(--gray-500); font-weight: 600; }

/* Gráfico de rosca (distribuição por status) */
.dash-donut-wrap {
  display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
  padding-top: 6px;
}
.dash-donut {
  position: relative;
  width: 150px; height: 150px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.dash-donut::after {
  content: "";
  position: absolute; inset: 26px;
  background: var(--white);
  border-radius: 50%;
}
.dash-donut-center {
  position: absolute; inset: 0; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.dash-donut-center .n { font-size: 24px; font-weight: 800; color: var(--black); line-height: 1; }
.dash-donut-center .l { font-size: 11px; color: var(--gray-500); margin-top: 3px; }
.dash-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 160px; }
.dash-legend li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--gray-700); }
.dash-legend .dot { width: 12px; height: 12px; border-radius: 3px; flex: 0 0 auto; }
.dash-legend .lg-label { flex: 1; }
.dash-legend .lg-value { font-weight: 700; color: var(--ink); }

/* Barras horizontais (métodos de pagamento) */
.dash-hbars { display: flex; flex-direction: column; gap: 14px; padding-top: 4px; }
.dash-hbar-row { display: grid; grid-template-columns: 130px 1fr auto; align-items: center; gap: 12px; }
.dash-hbar-label { font-size: 14px; font-weight: 600; color: var(--gray-700); }
.dash-hbar-track { display: block; width: 100%; background: var(--gray-100); border-radius: 999px; height: 14px; overflow: hidden; }
.dash-hbar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--yellow) 0%, var(--yellow-darker) 100%);
  border-radius: 999px;
  min-width: 6px;
}
.dash-hbar-value { font-size: 13px; font-weight: 700; color: var(--ink); white-space: nowrap; }

@media (max-width: 760px) {
  .dash-cols { grid-template-columns: 1fr; }
  .dash-bar-value { font-size: 10px; }
  .dash-donut-wrap { justify-content: center; }
  .dash-hbar-row { grid-template-columns: 96px 1fr auto; gap: 8px; }
  .dash-hbar-label { font-size: 13px; }
}

/* =========================================================
   PAINEL FRANQUEADO (header simples)
   ========================================================= */
.panel-body { background: var(--gray-50); color: var(--ink); min-height: 100vh; }
.panel-header {
  background: var(--black);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-header img { height: 24px; width: auto; filter: brightness(0) invert(1); }
.panel-header a { color: #fca5a5; text-decoration: none; font-size: 14px; font-weight: 600; }
.panel-main { max-width: 960px; margin: 40px auto; padding: 0 24px; }
.panel-hello { font-size: 22px; font-weight: 700; margin-bottom: 8px; color: var(--ink); }
.muted { color: var(--gray-500); }

/* =========================================================
   MOBILE — sidebar off-canvas + ajustes de tela pequena
   ========================================================= */
.menu-toggle {
  display: none;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
  padding: 8px;
  margin-right: 4px;
  cursor: pointer;
  border-radius: 8px;
}
.menu-toggle:hover { background: var(--gray-100); }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 40;
}
.topbar .topbar-left { display: flex; align-items: center; gap: 6px; min-width: 0; }
.topbar .who { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 880px) {
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 250px;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: var(--shadow-md);
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-backdrop.is-open { display: block; }

  .topbar { padding: 12px 16px; }
  .topbar h1 { font-size: 16px; }
  .topbar .who { font-size: 12px; max-width: 42vw; }

  .main { padding: 16px; }
  .card { padding: 16px; overflow-x: auto; }

  /* Tabelas: rolagem horizontal em vez de quebrar o layout */
  .card table { min-width: 560px; }
  th, td { padding: 10px 8px; white-space: nowrap; }

  .kpis { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
  .kpi { padding: 16px; }
  .kpi .n { font-size: 22px; }

  .pay-banner { padding: 18px 18px; }
  .pay-banner-value { font-size: 26px; }

  .detail-head { padding: 18px; }
}

@media (max-width: 480px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .topbar .who { max-width: 38vw; }
}
