/* ============================================================
   Painel Mestre - Tema Modern Dark
   Inspirado no dashboard de referência enviado pelo usuário.
   Escopo: dashboard, login, indicação, retorno de pagamento,
   formulários, tabelas, modais e telas responsivas.
   ============================================================ */

:root {
  --bg: #141820;
  --bg-deep: #10141b;
  --panel: #1d222c;
  --panel-2: #202630;
  --panel-3: #252c37;
  --surface-soft: #181d25;
  --surface-hover: #272f3b;
  --sidebar: #121720;
  --text: #f4f7fb;
  --text-soft: #d8dee8;
  --muted: #8f9aaa;
  --muted-2: #6e7887;
  --line: #2b3340;
  --line-soft: #242b36;
  --border: var(--line);
  --primary: #2f86ff;
  --primary2: #1f6ed8;
  --primary-soft: rgba(47, 134, 255, .13);
  --success: #20d67a;
  --success-soft: rgba(32, 214, 122, .12);
  --danger: #ff5d64;
  --danger-soft: rgba(255, 93, 100, .12);
  --warning: #f6b73c;
  --warning-soft: rgba(246, 183, 60, .13);
  --cyan: #35c3d6;
  --violet: #9b7cfb;
  --shadow: 0 12px 28px rgba(0, 0, 0, .18);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, .34);
  --radius: 12px;
  --radius-sm: 9px;
  --sidebar-width: 252px;
  --login-bg-image: none;
}

* { box-sizing: border-box; }
html { color-scheme: dark; background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: #78adff; }
[hidden] { display: none !important; }
::selection { background: rgba(47, 134, 255, .34); color: #fff; }

/* Scrollbar discreta */
* { scrollbar-width: thin; scrollbar-color: #3a4656 transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #394453; border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: #4a5667; border: 2px solid transparent; background-clip: padding-box; }

.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 20px; }
.positive { color: var(--success); font-weight: 800; }
.negative { color: var(--danger); font-weight: 800; }
.truncate { max-width: 280px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ============================================================
   Campos e formulários
   ============================================================ */
label {
  display: grid;
  gap: 7px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 720;
}
input, select, textarea {
  width: 100%;
  border: 1px solid #343d4a;
  border-radius: var(--radius-sm);
  outline: none;
  background: #171c24;
  color: var(--text);
  padding: 11px 12px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input::placeholder, textarea::placeholder { color: #687384; }
input:hover, select:hover, textarea:hover { border-color: #414c5b; }
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 134, 255, .13);
  background: #191f28;
}
input:disabled, select:disabled, textarea:disabled {
  opacity: .58;
  cursor: not-allowed;
}
input[readonly], textarea[readonly] { background: #141920; color: #b9c3d0; }
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
select option { background: #181d25; color: var(--text); }

.stack { display: grid; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.form-span-2 { grid-column: span 2; }
.three-col { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-actions { display: flex; align-items: end; gap: 9px; }
.form-actions > button { width: 100%; }
.check { display: flex; align-items: center; gap: 9px; align-self: end; padding: 10px 0; }
.check input { width: 17px; height: 17px; accent-color: var(--primary); }
.form-hint { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.settings-divider { grid-column: 1 / -1; border-top: 1px solid var(--line); margin: 5px 0 2px; }

/* ============================================================
   Botões
   ============================================================ */
.primary, .button-link.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 10px 15px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  text-align: center;
  box-shadow: none;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.primary:hover, .button-link.primary:hover { background: var(--primary2); border-color: var(--primary2); }
.primary:active, .button-link.primary:active { transform: translateY(1px); }
.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  border: 1px solid #37414f;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  background: #202630;
  color: #d5dce6;
  font-weight: 700;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.ghost:hover { background: #29313d; border-color: #465263; color: #fff; }
.danger-text { color: #ff8b90; }
.danger-text:hover { color: #ffb2b5; border-color: rgba(255, 93, 100, .32); background: var(--danger-soft); }
.mini {
  border: 1px solid #35404e;
  border-radius: 7px;
  padding: 7px 9px;
  background: #252c37;
  color: #dce3ed;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.mini:hover { background: #303947; border-color: #485567; }
.mini.success { border-color: rgba(32, 214, 122, .22); background: var(--success-soft); color: #61e8a2; }
.mini.danger { border-color: rgba(255, 93, 100, .25); background: var(--danger-soft); color: #ff8d92; }
.mini-link { color: #78adff; font-weight: 800; }
button:disabled, .primary:disabled, .ghost:disabled, .mini:disabled { opacity: .45; cursor: not-allowed; transform: none !important; }
.danger-primary { background: #d84f56 !important; border-color: #d84f56 !important; }
.danger-primary:hover { background: #c54249 !important; border-color: #c54249 !important; }

/* ============================================================
   Estrutura principal
   ============================================================ */
.app-page { min-height: 100vh; background: var(--bg); }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 16px 12px 14px;
  background: linear-gradient(180deg, #151a22 0%, #11161e 100%);
  border-right: 1px solid #29313d;
  color: #fff;
  box-shadow: 10px 0 30px rgba(0, 0, 0, .12);
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 56px;
  padding: 8px 9px;
  margin-bottom: 10px;
  border: 1px solid #2b3440;
  border-radius: 11px;
  background: #1a2029;
}
.brand > div:last-child { display: grid; gap: 2px; min-width: 0; }
.brand strong { font-size: 14px; letter-spacing: -.01em; }
.brand small { color: #7f8b9b; font-size: 10px; }
.brand-logo-wrap {
  width: 39px;
  height: 39px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #303947;
  border-radius: 10px;
  background: #1d242e;
}
.brand-logo { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 14px;
  background: #1f68c5;
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -.04em;
}
.brand-mark.small { width: 39px; height: 39px; border-radius: 9px; font-size: 12px; }
.sidebar nav {
  display: grid;
  gap: 5px;
  overflow-y: auto;
  padding: 0 2px 10px 0;
}
.nav-group-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 8px 3px;
  color: #697587;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.nav-group-label::after {
  content: '';
  height: 1px;
  flex: 1;
  background: #29313c;
}
.nav-link {
  position: relative;
  width: 100%;
  border: 1px solid #242d38;
  border-radius: 9px;
  background: #171d26;
  color: #a9b3c1;
  padding: 10px 11px;
  text-align: left;
  font-size: 12px;
  font-weight: 720;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.012);
  transition: background .14s ease, color .14s ease, border-color .14s ease, transform .14s ease;
}
.nav-link:hover {
  background: #202731;
  border-color: #364150;
  color: #f0f4f9;
  transform: translateX(2px);
}
.nav-link.active, .nav-link[aria-current="page"] {
  border-color: rgba(47, 134, 255, .45);
  background: linear-gradient(90deg, rgba(47, 134, 255, .18), #1c2430 74%);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--primary), 0 6px 16px rgba(0,0,0,.10);
  transform: none;
}
.nav-icon { display: inline-flex; width: 17px; justify-content: center; margin-right: 5px; color: #63a5ff; font-size: 9px; }
.sidebar > button:last-child {
  margin-top: auto;
  width: 100%;
  border-color: #343d49;
  background: #191f28;
}

.referral-role-setting {
  padding: 13px;
  border: 1px solid #303a47;
  border-radius: 10px;
  background: #191f28;
}
.referral-role-setting small { color: #8995a6; line-height: 1.45; }

.main-content {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: 24px 26px 34px;
  background: var(--bg);
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 58px;
  margin-bottom: 18px;
  padding-bottom: 13px;
  border-bottom: 1px solid #222936;
}
.topbar h1 { margin: 0 0 3px; color: #fff; font-size: 21px; font-weight: 850; letter-spacing: -.025em; }
.topbar p { margin: 0; font-size: 11px; }
.user-chip {
  min-width: 132px;
  display: grid;
  gap: 2px;
  padding: 8px 11px;
  border: 1px solid #2d3541;
  border-radius: 9px;
  background: #1a2029;
  text-align: right;
}
.user-chip span { color: #e9eef5; font-size: 12px; font-weight: 800; }
.user-chip small { color: #7f8a9a; font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.section { display: grid; gap: 15px; }
.section[hidden] { display: none !important; }

/* ============================================================
   Cards e painéis
   ============================================================ */
.panel, .stat-card, .dashboard-summary-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: none;
}
.panel { padding: 18px; }
.panel h2 { margin: 0 0 13px; color: #f4f7fb; font-size: 16px; font-weight: 830; letter-spacing: -.015em; }
.panel p { line-height: 1.5; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}
.panel-head h2 { margin: 0; }
.panel-head p { margin: 4px 0 0; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.stat-card { min-height: 118px; display: grid; align-content: space-between; gap: 9px; padding: 16px; }
.stat-card span { color: #aeb7c3; font-size: 10px; font-weight: 780; text-transform: uppercase; letter-spacing: .04em; }
.stat-card strong { color: #fff; font-size: 24px; line-height: 1; }
.stat-card.accent { background: linear-gradient(145deg, #1d242e, #202938); border-color: #334154; }

/* ============================================================
   Dashboard - visual inspirado na referência
   ============================================================ */
.dashboard-brand-banner {
  max-height: 170px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #1a2029;
}
.dashboard-brand-banner img { display: block; width: 100%; height: 100%; max-height: 170px; object-fit: cover; }
.quick-trial-feature {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  min-height: 88px;
  padding: 14px 16px;
  overflow: hidden;
  background: #1b222c;
  border-color: #2d3745;
}
.quick-trial-feature::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--primary);
}
.quick-trial-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(246, 183, 60, .25);
  border-radius: 10px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 20px;
}
.quick-trial-kicker { display: block; margin-bottom: 3px; color: #7f8a9b; font-size: 8px; font-weight: 900; letter-spacing: .15em; }
.quick-trial-feature h2 { margin: 0 0 3px; font-size: 15px; }
.quick-trial-feature p { margin: 0; font-size: 11px; }
.quick-trial-cta { min-width: 150px; }
.dashboard-ad {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 13px;
  border: 1px solid #303946;
  border-radius: 9px;
  background: #1b212a;
  color: #bdc6d2;
  font-size: 11px;
  font-weight: 750;
  text-decoration: none;
}
.dashboard-ad:hover { border-color: #3c4858; background: #202731; }
.dashboard-ad-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.dashboard-detailed { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.dashboard-summary-card { overflow: hidden; background: #1d232c; }
.dashboard-summary-card:hover { border-color: #364151; }
.dashboard-card-title {
  padding: 13px 14px 10px;
  border-bottom: 1px solid #2a323e;
  color: #eef2f7;
  font-size: 12px;
  font-weight: 820;
  letter-spacing: -.01em;
}
.dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: #2a323e;
}
.dashboard-metrics > div {
  min-height: 76px;
  display: grid;
  align-content: center;
  gap: 7px;
  padding: 12px 14px;
  background: #1f252f;
}
.dashboard-metrics span { color: #8e99a8; font-size: 9px; font-weight: 780; letter-spacing: .05em; text-transform: uppercase; }
.dashboard-metrics strong { color: #fff; font-size: 22px; line-height: 1; font-weight: 850; }
.dashboard-metrics > div:nth-child(1) strong { color: var(--success); }
.dashboard-metrics > div:nth-child(2) strong { color: #ff7c82; }
.dashboard-metrics > div:nth-child(3) strong { color: #f5f7fa; }
.dashboard-metrics > div:nth-child(4) strong { color: #60a5ff; }
.dashboard-more {
  width: 100%;
  border: 0;
  border-top: 1px solid #29313c;
  background: #1b212a;
  color: #78adff;
  padding: 9px 13px;
  text-align: left;
  font-size: 10px;
  font-weight: 760;
}
.dashboard-more:hover { background: #222a35; }
.dashboard-table-card { grid-column: 1 / -1; padding: 0; overflow: hidden; }
.dashboard-table-head { padding: 14px 17px 11px; border-bottom: 1px solid var(--line); }
.dashboard-table-head h2 { margin: 0 0 3px; font-size: 14px; }
.dashboard-table-head strong { color: #8995a5; font-size: 10px; }
.dashboard-table-card .table-wrap { padding: 0 8px 8px; }
.expected-revenue-card {
  grid-column: 1 / -1;
  display: grid;
  gap: 7px;
  padding: 18px 20px;
  border: 1px solid rgba(32, 214, 122, .2);
  border-radius: var(--radius);
  background: linear-gradient(110deg, #19231f, #1c242d 70%);
  box-shadow: none;
}
.expected-revenue-card span { color: #8fc8aa; font-size: 9px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.expected-revenue-card strong { color: var(--success); font-size: 30px; line-height: 1; }
.expected-revenue-card small { color: #8d9c96; font-size: 10px; }

/* ============================================================
   Tabelas
   ============================================================ */
.table-wrap { overflow: auto; border-radius: 9px; }
table { width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0; }
th, td {
  padding: 11px 10px;
  border-bottom: 1px solid #29313c;
  color: #dce2ea;
  text-align: left;
  vertical-align: middle;
  font-size: 11px;
}
th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #1a2028;
  color: #818d9d;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .06em;
  text-transform: uppercase;
}
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: #222934; }
tbody tr:last-child td { border-bottom: 0; }
td strong { color: #f0f3f7; }
td small { display: block; margin-top: 3px; color: #7f8a99; font-size: 9px; }
.empty { padding: 22px; color: #778393; text-align: center; }
.empty-state { padding: 22px; border: 1px dashed #343e4c; border-radius: 9px; background: #181d24; color: #7f8b9b; text-align: center; }
.clients-table { min-width: 1050px; }
.resellers-table { min-width: 1260px; }
.clients-table td, .resellers-table td { vertical-align: top; padding-top: 13px; padding-bottom: 13px; }
.client-user, .reseller-user { color: #79adff; }
.session-device { min-width: 250px; max-width: 420px; white-space: normal; word-break: break-word; }

/* Badges e status */
.badge, .status, .trial-badge, .prepaid-badge, .content-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #394352;
  border-radius: 999px;
  padding: 4px 7px;
  background: #252c36;
  color: #c3ccd7;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .04em;
}
.status { text-transform: capitalize; }
.status.active, .status.approved { border-color: rgba(32, 214, 122, .25); background: var(--success-soft); color: #63e7a4; }
.status.pending { border-color: rgba(246, 183, 60, .25); background: var(--warning-soft); color: #f7c85e; }
.status.past_due, .status.expired, .status.blocked, .status.canceled, .status.cancelled, .status.rejected, .status.charged_back { border-color: rgba(255, 93, 100, .25); background: var(--danger-soft); color: #ff8e93; }
.status.paused { border-color: rgba(155, 124, 251, .24); background: rgba(155, 124, 251, .11); color: #b9a5ff; }
.trial-badge { border-color: rgba(246, 183, 60, .28); background: var(--warning-soft); color: #f5bf4d; }
.prepaid-badge { margin-left: 4px; border-color: rgba(53, 195, 214, .24); background: rgba(53, 195, 214, .1); color: #6cd4e2; }
.content-badge { margin-left: 4px; }

/* ============================================================
   Clientes / Revendas
   ============================================================ */
.quick-actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }
.quick-role {
  border: 1px solid #36506f;
  border-radius: 8px;
  padding: 7px 9px;
  background: rgba(47, 134, 255, .1);
  color: #85b7ff;
  font-size: 10px;
  font-weight: 800;
}
.quick-role:hover { background: rgba(47, 134, 255, .16); }
.ownership-chip { display: inline-flex; align-items: center; padding: 6px 9px; border: 1px solid rgba(32, 214, 122, .22); border-radius: 999px; background: var(--success-soft); color: #67e4a4; font-size: 9px; font-weight: 850; white-space: nowrap; }
.clients-head, .resellers-head { align-items: flex-end; }
.client-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.client-filters input { width: 235px; }
.client-filters select { width: 165px; }
.client-actions, .row-actions, .credit-row-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.client-actions { min-width: 300px; }
.credit-row-actions { min-width: 365px; }
.action-btn {
  min-height: 30px;
  border: 1px solid #374251;
  border-radius: 7px;
  padding: 6px 8px;
  background: #252d38;
  color: #d8e0ea;
  font-size: 10px;
  font-weight: 820;
  white-space: nowrap;
  transition: background .12s ease, border-color .12s ease;
}
.action-btn:hover { background: #303a48; border-color: #4a586a; }
.action-edit { color: #dfe6ef; }
.action-playlist { border-color: rgba(47, 134, 255, .25); background: rgba(47, 134, 255, .1); color: #80b3ff; }
.action-renew { border-color: rgba(155, 124, 251, .25); background: rgba(155, 124, 251, .1); color: #baa7ff; }
.action-whatsapp, .action-unlock { border-color: rgba(32, 214, 122, .23); background: var(--success-soft); color: #62e6a3; }
.action-lock, .action-delete { border-color: rgba(255, 93, 100, .22); background: var(--danger-soft); color: #ff9095; }
.client-name-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.trial-row { background: rgba(246, 183, 60, .025); }
.client-note { margin-top: 7px !important; padding: 6px 8px; border-left: 2px solid #465363; border-radius: 4px; background: #181d24; color: #8894a4 !important; }
.client-master-info { margin-top: 7px !important; color: #83b5ff !important; }

.client-manager { padding: 0; overflow: hidden; }
.client-page-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 17px 18px; border-bottom: 1px solid var(--line); }
.client-page-head h2 { margin: 0 0 3px; }
.client-page-head p { margin: 0; font-size: 10px; }
.client-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) minmax(145px, .7fr) minmax(175px, .9fr) auto;
  gap: 10px;
  align-items: end;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  background: #191f27;
}
.toolbar-field { color: #7f8b9c; font-size: 9px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.toolbar-field input, .toolbar-field select { margin-top: 2px; text-transform: none; letter-spacing: normal; }
.toolbar-button { height: 40px; }
.client-list-summary { display: flex; justify-content: space-between; align-items: center; padding: 9px 18px; border-bottom: 1px solid var(--line); color: #8c98a8; font-size: 10px; }
.clients-table-wrap { padding: 0 12px 10px; }

.master-client-info { padding: 13px; border: 1px solid rgba(47, 134, 255, .2); border-radius: 10px; background: rgba(47, 134, 255, .055); }
.master-info-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.master-info-head small { color: #8390a1; }

/* Créditos */
.credit-balance {
  min-width: 82px;
  display: inline-grid;
  gap: 2px;
  padding: 7px 9px;
  border: 1px solid #35404d;
  border-radius: 8px;
  background: #202731;
}
.credit-balance strong { color: #f2f5f8; font-size: 17px; line-height: 1; font-weight: 900; }
.credit-balance small { margin: 1px 0 0 !important; color: #7f8b9b; font-size: 7px; font-weight: 900; letter-spacing: .1em; }
.credit-balance.credit-unlimited { border-color: rgba(155, 124, 251, .28); background: rgba(155, 124, 251, .09); }
.credit-balance.credit-unlimited strong { color: #b7a1ff; font-size: 24px; }
.credit-balance.credit-unlimited small { color: #a793eb; }
.credit-action-note { display: inline-flex; align-items: center; padding: 6px 8px; border: 1px solid rgba(155, 124, 251, .2); border-radius: 7px; background: rgba(155, 124, 251, .08); color: #b9a8f7; font-size: 9px; font-weight: 800; white-space: nowrap; }
.credit-edit-box { display: grid; gap: 8px; padding: 11px; border: 1px solid #35404d; border-radius: 9px; background: #181e26; }
.credit-edit-label { color: #94a0af; font-size: 10px; font-weight: 800; }
.credit-edit-balance { display: flex; align-items: baseline; gap: 7px; }
.credit-edit-balance strong { color: #f1f4f8; font-size: 27px; line-height: 1; }
.credit-edit-balance strong.is-infinite { color: #b7a1ff; font-size: 36px; }
.credit-edit-balance small { color: #818d9d; font-size: 9px; font-weight: 650; }
.credit-edit-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.credit-edit-actions button { flex: 1 1 125px; }
.credit-adjust-current { display: grid; gap: 3px; padding: 14px; border: 1px solid #35404d; border-radius: 10px; background: #181e26; }
.credit-adjust-current span { color: #818d9d; font-size: 9px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.credit-adjust-current strong { color: #f3f5f8; font-size: 32px; line-height: 1; }
.credit-adjust-current small { color: #818d9d; }
.credit-adjust-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
#walletBalance.unlimited-wallet { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.wallet-infinity { color: #b6a0ff; font-size: 42px; line-height: .8; font-weight: 900; }
#walletBalance.unlimited-wallet small { color: #a591e9; font-size: 9px; font-weight: 900; letter-spacing: .08em; }
#resellerBalanceGroup small { color: #7f8a99; font-weight: 600; }

/* ============================================================
   Modais
   ============================================================ */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 22px; }
.modal[hidden] { display: none !important; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(7, 10, 14, .76); backdrop-filter: blur(4px); }
.modal-card {
  position: relative;
  z-index: 1;
  width: min(860px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  padding: 20px;
  border: 1px solid #374151;
  border-radius: 13px;
  background: #1c222b;
  box-shadow: var(--shadow-lg);
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 16px; }
.modal-head h2 { margin: 0 0 4px; font-size: 17px; }
.modal-head p { margin: 0; }
.modal-close { width: 34px; height: 34px; flex: 0 0 auto; border: 1px solid #384352; border-radius: 8px; background: #252d38; color: #aeb8c5; font-size: 21px; line-height: 1; }
.modal-close:hover { background: #303947; color: #fff; }
.modal-open { overflow: hidden; }
.client-editor-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.client-editor-form label small { color: #7d8999; font-weight: 500; }
.client-modal-actions { grid-column: 1 / -1; justify-content: flex-end; }
.client-modal-actions button { width: auto; min-width: 130px; }
.playlist-modal-card { width: min(760px, 100%); }
.quick-trial-modal-card { width: min(560px, 100%); }
.credit-adjust-modal-card { width: min(520px, 100%); }
.credentials-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-bottom: 14px; }
.credentials-grid > div { padding: 11px; border: 1px solid #333d4b; border-radius: 9px; background: #181e26; }
.credentials-grid small { display: block; margin-bottom: 3px; color: #7f8b9b; font-size: 9px; }
.credentials-grid strong { color: #e9eef5; font-size: 11px; word-break: break-all; }
.playlist-url-label textarea { font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.playlist-url-label button { margin-top: 9px; }
.playlist-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.trial-duration-card { display: grid; gap: 3px; padding: 12px; border: 1px solid rgba(47, 134, 255, .22); border-radius: 9px; background: rgba(47, 134, 255, .07); }
.trial-duration-card span { color: #8390a0; font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.trial-duration-card strong { color: #79adff; font-size: 19px; }
.trial-duration-card small { color: #7e8a9b; }

/* ============================================================
   Avisos / tickets / anotações / utilidades
   ============================================================ */
.notice-list { display: grid; gap: 10px; }
.notice-card { padding: 14px; border: 1px solid #313a47; border-radius: 10px; background: #1a2028; }
.notice-card.notice-inactive { opacity: .58; }
.notice-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.notice-card h3 { margin: 0 0 3px; color: #edf1f6; font-size: 14px; }
.notice-card small { color: #7c8898; }
.notice-card p { margin: 11px 0 0; color: #b7c0cc; line-height: 1.55; }
.status-list { display: grid; gap: 8px; }
.status-list div { display: flex; justify-content: space-between; gap: 12px; padding: 10px; border: 1px solid #303946; border-radius: 8px; background: #191f27; }
.webhook-box { margin-top: 15px; padding: 11px; border: 1px dashed #3a4655; border-radius: 8px; background: #181d24; }
.webhook-box small { display: block; margin-bottom: 5px; color: #7f8a99; }
.webhook-box code { color: #a9caff; font-size: 10px; word-break: break-all; }
.notes-footer { display: flex; align-items: center; justify-content: space-between; gap: 11px; margin-top: 11px; }
.notes-footer .primary { min-width: 170px; }
.migration-result { margin-top: 14px; padding: 12px; border: 1px solid rgba(47, 134, 255, .2); border-radius: 9px; background: rgba(47, 134, 255, .06); color: #b8c7da; line-height: 1.5; }
.migration-result details { margin-top: 9px; }
.migration-result ul { max-height: 210px; overflow: auto; margin-bottom: 0; }
.mini-select { min-width: 125px; border-radius: 7px; padding: 7px 8px; }

/* ============================================================
   Configurações / branding / API
   ============================================================ */
.settings-preview-block { padding: 14px; border: 1px dashed #3a4554; border-radius: 10px; background: #181e26; }
.settings-preview-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.settings-preview-head strong { display: block; color: #e7ecf2; font-size: 12px; }
.settings-preview-head small { display: block; margin-top: 2px; color: #7f8b9b; }
.branding-preview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.branding-preview-card { padding: 10px; border: 1px solid #303a47; border-radius: 9px; background: #1c222b; }
.branding-preview-card > span { display: block; margin-bottom: 7px; color: #7f8b9b; font-size: 9px; font-weight: 800; }
.preview-login-logo, .preview-banner { height: 118px; display: grid; place-items: center; overflow: hidden; border: 1px solid #303a47; border-radius: 8px; background: #121820; }
.preview-login-logo img { max-width: 88%; max-height: 94px; object-fit: contain; }
.preview-banner img { width: 100%; height: 100%; object-fit: cover; }
.preview-fallback { width: 72px; height: 72px; display: grid; place-items: center; border: 1px solid #3d4857; border-radius: 15px; background: #202832; color: #fff; font-weight: 900; }
.preview-fallback.wide { width: auto; height: auto; border: 0; background: transparent; }
.preview-background { height: 118px; display: grid; place-items: center; border-radius: 8px; background-position: center; background-size: cover; color: #fff; text-shadow: 0 2px 9px #000; }
.preview-ad { min-height: 56px; display: flex; align-items: center; padding: 10px; border: 1px solid #303a47; border-radius: 8px; background: #181e26; color: #aab4c1; font-weight: 700; }
.media-help { display: block; margin: 4px 0 8px; color: #748090; font-size: 9px; font-weight: 600; line-height: 1.45; }
.media-upload-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-top: 7px; }
.media-upload-row input[type="file"] { padding: 7px; font-size: 10px; }
.media-upload-btn { white-space: nowrap; }
.api-docs pre { overflow: auto; padding: 14px; border: 1px solid #303947; border-radius: 9px; background: #10151c; color: #ccd8e8; white-space: pre-wrap; }
.api-docs h3 { margin: 20px 0 7px; color: #edf2f7; }

/* ============================================================
   Indicação
   ============================================================ */
.referral-link-panel { max-width: 860px; }
.referral-link-grid { display: grid; gap: 14px; }
.referral-link-panel .playlist-url-label { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.referral-link-panel .playlist-url-label button { margin-top: 0; min-width: 112px; }
.referral-link-panel small { color: #7f8b9b; font-weight: 500; }
.ref-message { min-height: 19px; font-size: 11px; }
.ref-message.success { color: var(--success); }
.ref-message.error { color: var(--danger); }
.ref-success { margin-top: 19px; padding: 15px; border: 1px solid rgba(32, 214, 122, .22); border-radius: 11px; background: rgba(32, 214, 122, .06); text-align: left; }
.success-kicker { color: #62df9f; font-size: 8px; font-weight: 900; letter-spacing: .12em; }
.ref-success h2 { margin: 5px 0 12px; font-size: 16px; }
.ref-data-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 12px; }
.ref-data-grid > div { display: grid; gap: 2px; padding: 9px; border: 1px solid #304039; border-radius: 8px; background: #18211e; }
.ref-data-grid span { color: #7d8d86; font-size: 9px; }
.ref-data-grid strong { color: #e8f2ed; font-size: 11px; }
.ref-success .primary { width: 100%; margin-bottom: 7px; }
.ref-back { display: inline-block; margin-top: 17px; color: #7eaff7; font-size: 11px; font-weight: 750; text-decoration: none; }
.ref-back:hover { color: #a3c8ff; }

/* ============================================================
   Login / retorno de pagamento
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  position: relative;
  overflow: auto;
  padding: 24px;
  background: #0f1319;
}
.login-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(120deg, rgba(10, 13, 18, .9), rgba(15, 20, 27, .8)),
    var(--login-bg-image),
    radial-gradient(circle at 18% 12%, rgba(47, 134, 255, .13), transparent 36%);
  background-position: center;
  background-size: cover;
}
.login-shell {
  position: relative;
  z-index: 1;
  width: min(1000px, 100%);
  min-height: 570px;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  overflow: hidden;
  border: 1px solid #303946;
  border-radius: 16px;
  background: #181e26;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .38);
}
.login-visual {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 44px;
  background: linear-gradient(145deg, #131a23, #1b2735 60%, #193760);
}
.login-visual::after { content: ""; position: absolute; width: 360px; height: 360px; right: -180px; bottom: -200px; border-radius: 50%; background: rgba(47, 134, 255, .08); }
.login-visual-overlay { position: absolute; inset: 0; background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .13)); }
.login-brand-stage { position: relative; z-index: 1; color: #fff; text-align: center; }
.login-logo-large { display: block; max-width: min(340px, 82%); max-height: 230px; object-fit: contain; margin: 0 auto 24px; }
.login-logo-fallback { width: 150px; height: 150px; display: grid; place-items: center; margin: 0 auto 24px; border: 1px solid #425065; border-radius: 24px; background: rgba(255, 255, 255, .055); color: #fff; font-size: 50px; font-weight: 950; letter-spacing: -.05em; }
.login-brand-stage h1 { margin: 0 0 8px; font-size: 31px; letter-spacing: -.04em; }
.login-brand-stage p { max-width: 400px; margin: 0 auto; color: #9eabbc; font-size: 13px; line-height: 1.6; }
.login-card {
  position: relative;
  z-index: 1;
  width: min(430px, 100%);
  padding: 31px;
  border: 1px solid #303946;
  border-radius: 14px;
  background: #1b212a;
  color: var(--text);
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-card h1 { margin: 13px 0 5px; font-size: 23px; }
.modern-login-card {
  width: auto !important;
  max-width: none !important;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 0 !important;
  padding: 50px 42px !important;
  border: 0 !important;
  border-left: 1px solid #303946 !important;
  border-radius: 0 !important;
  background: #1b212a !important;
  box-shadow: none !important;
  text-align: left;
}
.login-card-head { margin-bottom: 23px; }
.login-eyebrow { display: inline-block; margin-bottom: 9px; color: #6ba8ff; font-size: 9px; font-weight: 900; letter-spacing: .14em; }
.login-card-head h2 { margin: 0 0 6px; color: #f6f8fb; font-size: 27px; letter-spacing: -.035em; }
.login-card-head p { margin: 0; font-size: 11px; }
.login-form-modern { display: grid; gap: 14px; }
.login-form-modern label { color: #aeb8c5; font-size: 10px; font-weight: 800; }
.login-form-modern input { height: 44px; margin-top: 5px; }
.login-submit { height: 44px; margin-top: 2px; }
.login-footnote { margin-top: 21px; color: #667282; font-size: 9px; text-align: center; }
.modern-login-card .error { min-height: 17px; margin: 10px 0 0; font-size: 10px; font-weight: 700; }
.referral-card { width: min(560px, 100%); text-align: center; }
.referral-card .brand-mark { margin: auto; }
.referral-page .stack { text-align: left; }

/* ============================================================
   Toasts
   ============================================================ */
.toast {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 200;
  max-width: 380px;
  padding: 10px 13px;
  border: 1px solid #394453;
  border-radius: 9px;
  background: #202731;
  color: #fff;
  box-shadow: var(--shadow-lg);
  font-size: 11px;
  font-weight: 700;
}
.toast-ok { border-color: rgba(32, 214, 122, .28); background: #163128; color: #a8f5ce; }
.toast-error { border-color: rgba(255, 93, 100, .3); background: #3a2024; color: #ffc0c3; }

/* ============================================================
   Responsivo
   ============================================================ */
@media (max-width: 1250px) {
  .dashboard-detailed { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-table-card, .expected-revenue-card { grid-column: 1 / -1; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1050px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .three-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .client-toolbar { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    padding: 9px 10px;
    border-right: 0;
    border-bottom: 1px solid #28303a;
  }
  .brand { min-height: 44px; margin: 0 0 7px; padding: 0 2px 8px; border-bottom: 1px solid #252d37; }
  .brand-logo-wrap, .brand-mark.small { width: 34px; height: 34px; }
  .sidebar nav { display: flex; gap: 5px; overflow-x: auto; overflow-y: hidden; padding: 0 0 2px; }
  .nav-group-label { display: none; }
  .nav-link { width: auto; flex: 0 0 auto; padding: 8px 10px; white-space: nowrap; }
  .sidebar > button:last-child { position: absolute; top: 12px; right: 10px; width: auto; min-height: 32px; padding: 6px 10px; }
  .main-content { margin-left: 0; padding: 18px 16px 28px; }
  .topbar { margin-bottom: 14px; }
  .clients-head, .resellers-head, .client-page-head { align-items: stretch; flex-direction: column; }
  .client-page-head .primary { align-self: flex-start; }
  .quick-actions { justify-content: flex-start; }
  .client-filters { width: 100%; }
  .client-filters input, .client-filters select { flex: 1 1 170px; width: auto; }
  .client-editor-form { grid-template-columns: 1fr; }
  .client-modal-actions { grid-column: 1; }
  .branding-preview-grid { grid-template-columns: 1fr; }
  .login-shell { max-width: 610px; grid-template-columns: 1fr; }
  .login-visual { min-height: 300px; padding: 30px; }
  .login-logo-large { max-height: 165px; }
  .login-logo-fallback { width: 110px; height: 110px; font-size: 38px; }
  .modern-login-card { padding: 34px 28px !important; border-left: 0 !important; border-top: 1px solid #303946 !important; }
}

@media (max-width: 700px) {
  .topbar { align-items: flex-start; }
  .user-chip { display: none; }
  .dashboard-detailed { grid-template-columns: 1fr; }
  .dashboard-table-card, .expected-revenue-card { grid-column: auto; }
  .quick-trial-feature { grid-template-columns: auto 1fr; }
  .quick-trial-feature .primary { grid-column: 1 / -1; width: 100%; }
  .form-grid, .two-col, .three-col, .client-toolbar { grid-template-columns: 1fr; }
  .form-span-2, .settings-divider { grid-column: 1; }
  .client-page-head .primary { width: 100%; }
  .credentials-grid { grid-template-columns: 1fr; }
  .credit-adjust-actions { grid-template-columns: 1fr; }
  .notes-footer, .notice-card-head, .master-info-head { align-items: stretch; flex-direction: column; }
  .notes-footer .primary { width: 100%; }
  .media-upload-row { grid-template-columns: 1fr; }
  .media-upload-btn { width: 100%; }
  .referral-link-panel .playlist-url-label { grid-template-columns: 1fr; }
  .referral-link-panel .playlist-url-label button { width: 100%; }
}

@media (max-width: 560px) {
  .main-content { padding: 15px 11px 24px; }
  .panel { padding: 14px; }
  .topbar h1 { font-size: 19px; }
  .cards { grid-template-columns: 1fr; }
  .dashboard-metrics { grid-template-columns: 1fr 1fr; }
  .dashboard-metrics strong { font-size: 20px; }
  .modal { padding: 8px; }
  .modal-card { max-height: calc(100vh - 16px); padding: 15px; }
  .client-modal-actions { display: grid; grid-template-columns: 1fr; }
  .client-modal-actions button { width: 100%; }
  .credit-row-actions { min-width: 290px; }
  .ref-data-grid { grid-template-columns: 1fr; }
  .login-page { padding: 10px; }
  .login-shell { min-height: 0; border-radius: 12px; }
  .login-visual { min-height: 245px; padding: 24px 16px; }
  .login-brand-stage h1 { font-size: 25px; }
  .login-brand-stage p { font-size: 11px; }
  .login-logo-large { max-height: 125px; margin-bottom: 16px; }
  .login-logo-fallback { width: 90px; height: 90px; margin-bottom: 16px; border-radius: 18px; font-size: 32px; }
  .modern-login-card { padding: 27px 19px !important; }
  .login-card { padding: 24px 18px; }
}

/* Ajustes de classes funcionais específicas */
.active-section { min-width: 0; }
.quick-trial-panel { width: 100%; }
.client-modal-card { width: min(820px, 100%); }
.credit-action-btn { min-height: 30px; }

/* v3.1.7 - organizacao Revendas x Mensalistas */
.section-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.reseller-create-modal-card { width: min(820px, 100%); }
.reseller-create-roles {
  justify-content: flex-start;
  margin: -2px 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #303947;
}
.reseller-create-form label[hidden] { display: none !important; }
@media (max-width: 820px) {
  .section-head-actions { justify-content: flex-start; width: 100%; }
}
@media (max-width: 560px) {
  .section-head-actions { display: grid; grid-template-columns: 1fr; }
  .section-head-actions button { width: 100%; }
}

/* v3.1.8 - atalhos de gestão */
.reseller-whatsapp-btn {
  border-color: rgba(32, 214, 122, .22);
  background: var(--success-soft);
  color: #61e8a2;
}
.payment-day-permission-btn { white-space: nowrap; }

/* v3.1.9 - renovacao por Pix */
.pix-renewal-modal-card { width: min(720px, 100%); }
.pix-renewal-result { display: grid; gap: 14px; }
.pix-renewal-summary { margin-top: 4px; }
.pix-qr-wrap { display: flex; justify-content: center; align-items: center; min-height: 220px; padding: 14px; border: 1px solid var(--border, #303947); border-radius: 14px; background: rgba(255,255,255,.03); }
.pix-qr-wrap img { width: min(280px, 80vw); height: auto; border-radius: 10px; background: #fff; padding: 8px; }
.pix-renewal-result textarea { width: 100%; resize: vertical; word-break: break-all; }
.pix-renewal-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pix-renewal-actions .button-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.pix-renew-btn { white-space: nowrap; }
@media (max-width: 560px) { .pix-renewal-actions { display: grid; grid-template-columns: 1fr; } .pix-renewal-actions > * { width: 100%; } }


/* v3.2.0 - Pagamentos centralizados no painel */
.payment-panel-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:14px; }
.payment-filters { display:grid; grid-template-columns:minmax(220px, 1fr) minmax(180px, 240px); gap:12px; margin-bottom:14px; }
.payment-filters label { margin:0; }
.payment-details-modal-card { width:min(860px, 100%); }
.payment-details-grid { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:12px; margin:8px 0 18px; }
.payment-detail-item { border:1px solid var(--border); border-radius:12px; padding:12px; display:grid; gap:5px; min-width:0; background:rgba(255,255,255,.02); }
.payment-detail-item small { color:var(--muted); }
.payment-detail-item strong, .payment-detail-item code { overflow-wrap:anywhere; }
@media (max-width:720px) {
  .payment-panel-head { display:grid; }
  .payment-filters, .payment-details-grid { grid-template-columns:1fr; }
}
