/* NIVO Afiliados Portal — Nike/Strava style
 * Preto absoluto + accent verde-limão + tipografia bold + spacing generoso
 */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #000;
  --bg-elev: #0A0A0A;
  --bg-card: #0F0F0F;
  --border: rgba(255,255,255,0.08);
  --border-focus: rgba(191,255,0,0.4);
  --text: #FFFFFF;
  --text-dim: #9CA3AF;
  --text-muted: #6B7280;
  --accent: #BFFF00;
  --accent-dim: rgba(191,255,0,0.08);
  --danger: #FF453A;
  --warning: #FFB020;
  --success: #30D158;
  --radius: 16px;
  --radius-sm: 10px;
}
html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, system-ui, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
body { font-size: 15px; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { opacity: 0.85; }

/* ---------- SPLASH ---------- */
#splash {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 32px;
  background: radial-gradient(circle at 50% 0%, rgba(191,255,0,0.06) 0%, #000 60%);
}
.brand {
  font-size: 14px; font-weight: 900;
  letter-spacing: 6px;
  color: var(--text);
}
.brand .dot { color: var(--accent); margin: 0 6px; }

/* ---------- LOGO MARK (uses /nivo-logo.png) ---------- */
.splash-logo {
  width: 180px; height: auto; display: block;
  filter: drop-shadow(0 4px 24px rgba(191,255,0,0.15));
}
.brand-sub {
  font-size: 11px; font-weight: 900;
  letter-spacing: 8px;
  color: var(--accent);
  margin-top: 4px;
}
.auth-logo {
  width: 160px; height: auto; display: block;
  margin: 0 auto;
}
.mark-sub {
  display: block;
  width: auto;
  text-align: center;
  font-size: 11px;
  letter-spacing: 10px;
  font-weight: 900;
  color: var(--accent);
  margin: 10px 0 0 0;
  /* Alinha visualmente com o wordmark "NIVO", ignorando a bandeirinha
     à esquerda do logo. O logo tem ~22% de largura ocupada pelo ícone,
     então deslocamos o texto para a direita para centralizar sob "NIVO". */
  padding-left: 36px;
}
.sidebar-logo {
  width: 110px; height: auto; display: block;
  margin-bottom: 4px;
}
.brand-sub-side {
  display: block;
  font-size: 10px; letter-spacing: 5px; font-weight: 900;
  color: var(--accent);
  padding-left: 2px;
}
.loader {
  width: 28px; height: 28px;
  border: 3px solid rgba(255,255,255,0.08);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- LAYOUT ---------- */
.auth-shell {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 48px 24px;
  background: #000;
  position: relative;
  overflow: hidden;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  position: relative;
  z-index: 2;
  animation: fade-up 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: 0.2s;
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- BACKGROUND FULLSCREEN (imagem Nike-NIVO) ---------- */
.auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.auth-bg-img {
  position: absolute; inset: 0;
  background-image: url("https://images.unsplash.com/photo-1549060279-7e168fcee0c2?w=1920&q=85&auto=format&fit=crop");
  background-size: cover;
  background-position: center 40%;
  transform: scale(1.08);
  animation: slow-zoom 30s ease-in-out infinite alternate;
}
@media (max-width: 900px) {
  .auth-bg-img {
    background-position: 60% center;
  }
}
@keyframes slow-zoom {
  from { transform: scale(1.08); }
  to   { transform: scale(1.18); }
}
.auth-bg-overlay {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 70% at center, rgba(0,0,0,0.72) 0%, rgba(0,0,0,0.55) 45%, rgba(0,0,0,0.4) 100%),
    linear-gradient(180deg, rgba(0,0,0,0.35) 0%, rgba(0,0,0,0.55) 100%);
}
.auth-bg-grain {
  position: absolute; inset: 0;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='1'/></svg>");
}

.auth-brand {
  text-align: center;
  margin-bottom: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.auth-brand .mark {
  font-size: 0; letter-spacing: 0; font-weight: 400;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 0;
  width: 100%;
}
.auth-brand h1 {
  font-size: 24px; font-weight: 900;
  letter-spacing: -0.5px;
  margin-top: 36px;
  text-transform: uppercase;
  line-height: 1;
}
.auth-brand p {
  color: var(--text-dim);
  font-size: 11px;
  margin-top: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 600;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
}
.sidebar {
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  padding: 28px 16px;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.sidebar .brand { padding-left: 10px; margin-bottom: 36px; }
.nav-item {
  display: flex; align-items: center;
  padding: 12px 14px;
  margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.3px;
}
.nav-item:hover { background: rgba(255,255,255,0.03); color: var(--text); }
.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}
.nav-item .ico { margin-right: 10px; font-size: 16px; }
.nav-item.logout { color: var(--danger); margin-top: 20px; }

.main {
  padding: 32px 40px;
  min-width: 0;
}
.page-header {
  margin-bottom: 32px;
}
.page-header .eyebrow { font-size: 11px; letter-spacing: 4px; font-weight: 900; color: var(--accent); }
.page-header h1 { font-size: 32px; font-weight: 900; letter-spacing: -0.8px; margin-top: 6px; }
.page-header p { color: var(--text-dim); margin-top: 6px; }

/* ---------- INPUTS ---------- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 11px; letter-spacing: 2px;
  font-weight: 700; text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.field input, .field select, .field textarea {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  transition: border-color 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--border-focus);
}
.field .hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* ---------- MINIMALIST AUTH OVERRIDES (Nike/Strava style) ---------- */
/* Applied only inside .auth-shell — pós-login (sidebar/dashboard) intacto */
.auth-shell .field { margin-bottom: 28px; }
.auth-shell .field label {
  font-size: 10px; letter-spacing: 3px; color: var(--text-muted);
  margin-bottom: 10px;
}
.auth-shell .field input,
.auth-shell .field select,
.auth-shell .field textarea {
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  border-radius: 0;
  padding: 10px 2px 12px 2px;
  font-size: 16px;
  color: var(--text);
  transition: border-color 0.2s;
}
.auth-shell .field input:focus,
.auth-shell .field select:focus,
.auth-shell .field textarea:focus {
  border-bottom-color: var(--accent);
  box-shadow: none;
}
.auth-shell .btn {
  border-radius: 0;
  padding: 20px 22px;
  font-size: 14px;
  letter-spacing: 2px;
  font-weight: 900;
}
.auth-shell .btn.block { width: 100%; margin-top: 12px; }
.auth-shell .btn:hover { background: #A9E600; transform: none; }
.auth-shell .btn.ghost { border: 1px solid rgba(255,255,255,0.15); }
.auth-shell .auth-footer { margin-top: 32px; text-align: center; }
.auth-shell .auth-footer a {
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 700;
  display: inline-block;
  margin: 6px 0;
}
.auth-shell .error-msg {
  color: var(--danger);
  font-size: 13px;
  letter-spacing: 1px;
  margin-top: 16px;
  text-align: center;
  text-transform: uppercase;
  font-weight: 700;
}

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 14px 22px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 999px;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
  font-family: inherit;
  gap: 8px;
}
.btn:hover { background: #A9E600; transform: translateY(-1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn.block { width: 100%; }
.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn.ghost:hover { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.2); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { background: #E6392F; }

/* ---------- CARDS ---------- */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.stat .label {
  font-size: 11px; letter-spacing: 2px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
}
.stat .value {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -1px;
  margin-top: 10px;
  color: var(--text);
}
.stat .value.accent { color: var(--accent); }
.stat .hint { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

.link-card {
  background: linear-gradient(135deg, rgba(191,255,0,0.1), rgba(191,255,0,0.02));
  border: 1px solid rgba(191,255,0,0.2);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
}
.link-card .eyebrow { color: var(--accent); font-size: 11px; letter-spacing: 4px; font-weight: 900; }
.link-card .link-url {
  display: flex; align-items: center; gap: 12px;
  margin-top: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 14px;
  overflow-x: auto;
}
.link-card .link-url .url { flex: 1; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-card .link-code {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 16px;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 999px;
  font-family: ui-monospace, Menlo, monospace;
  font-weight: 700;
  letter-spacing: 2px;
  font-size: 13px;
}

/* ---------- TABLES ---------- */
.table-wrap {
  overflow-x: auto;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 18px; text-align: left; font-size: 14px; }
th {
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
  font-size: 11px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--text-muted); font-weight: 700;
}
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.015); }
td.muted { color: var(--text-dim); }

/* ---------- BADGES ---------- */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.badge.pending { background: rgba(255,176,32,0.1); color: var(--warning); }
.badge.available { background: rgba(191,255,0,0.08); color: var(--accent); }
.badge.paid { background: rgba(48,209,88,0.1); color: var(--success); }
.badge.reversed { background: rgba(255,69,58,0.1); color: var(--danger); }
.badge.approved { background: rgba(48,209,88,0.1); color: var(--success); }
.badge.suspended { background: rgba(255,69,58,0.1); color: var(--danger); }

/* ---------- TOAST ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: var(--accent); color: #000;
  padding: 14px 22px; border-radius: 999px;
  font-weight: 800; font-size: 13px; letter-spacing: 0.5px;
  z-index: 9999;
  box-shadow: 0 10px 30px rgba(191,255,0,0.3);
  animation: toast-in 0.3s cubic-bezier(0.22,1,0.36,1);
}
.toast.error { background: var(--danger); color: #fff; }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- ERROR / EMPTY ---------- */
.error-text { color: var(--danger); font-size: 13px; margin-top: 8px; }
.empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}
.empty .ico { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto;
    height: auto;
    display: flex;
    overflow-x: auto;
    padding: 10px 8px;
    border-top: 1px solid var(--border);
    border-right: none;
    z-index: 100;
  }
  .sidebar .brand { display: none; }
  .sidebar .nav-item {
    flex-direction: column;
    padding: 8px 10px;
    font-size: 10px;
    letter-spacing: 0.5px;
    margin: 0 2px;
    min-width: 70px;
    text-align: center;
  }
  .sidebar .nav-item .ico { margin: 0 0 2px; font-size: 20px; }
  .sidebar .nav-item.logout { display: none; }
  .main { padding: 20px 16px 100px; }
  .page-header h1 { font-size: 24px; }
}
@media (max-width: 480px) {
  .auth-card { padding: 28px 20px; }
  .card-grid { grid-template-columns: 1fr 1fr; }
  .stat .value { font-size: 24px; }
}

/* ---------- HELPERS ---------- */
.space-y-16 > * + * { margin-top: 16px; }
.space-y-24 > * + * { margin-top: 24px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.text-dim { color: var(--text-dim); }
.text-accent { color: var(--accent); }
.center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-24 { margin-bottom: 24px; }
.hidden { display: none !important; }

/* ---------- MODAL ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: fade-in 0.2s ease-out both;
}
.modal.hidden { display: none !important; }
.modal-card {
  width: 100%; max-width: 440px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  animation: fade-up 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes fade-in { from { opacity: 0 } to { opacity: 1 } }
