/* ============================================================
   AFFILIATE DASHBOARD  v3.0  — THI Channel
   Sidebar : Warm Cream / Ivory (bukan hitam)
   Aksen   : #DDB760 gold
   Body    : Putih + abu muda
   Icons   : Font Awesome (sudah load di header)
   Grid    : Bootstrap container > row > col-md-*
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;600;700&display=swap');

/* ── Variables ── */
:root {
  /* Gold palette */
  --gold:        #DDB760;
  --gold-h:      #C9A44E;       /* hover */
  --gold-light:  #EDD28A;
  --gold-dark:   #9C7530;
  --gold-bg:     rgba(221,183,96,.10);
  --gold-border: rgba(221,183,96,.30);

  /* Sidebar — cream/ivory */
  --sb-bg:       #FDFAF4;       /* warm cream */
  --sb-border:   #EDE8DA;       /* cream border */
  --sb-text:     #4A3F2A;       /* warm dark brown */
  --sb-muted:    #9A8E78;       /* muted warm */
  --sb-active-bg:#DDB760;       /* aktif = gold solid */
  --sb-active-tx:#1A1000;
  --sb-hover-bg: rgba(221,183,96,.12);
  --sb-hover-tx: #6B520A;

  /* Content area */
  --body:    #F5F5F3;
  --white:   #FFFFFF;
  --panel:   #FFFFFF;
  --border:  #E6E6E4;
  --text:    #1A1A1A;
  --subtext: #555555;
  --muted:   #8A8A8A;

  /* Status */
  --success: #16A34A;
  --danger:  #DC2626;
  --warn:    #D97706;
  --info:    #2563EB;

  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 1px 3px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.05);
  --shadow-g:  0 4px 20px rgba(221,183,96,.22);
  --tr:        .17s ease;
}

/* ── Reset ── */
#aff-dashboard * { box-sizing: border-box; }
#aff-dashboard {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--body);
  color: var(--text);
}

/* ══════════════════════════════════════
   LAYOUT  —  sidebar sticky, footer full
══════════════════════════════════════ */
.aff-shell {
  display: flex;
  align-items: flex-start;
}

/* ══════════════════════════════════════
   SIDEBAR  —  Warm Cream
══════════════════════════════════════ */
.aff-sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--sb-bg);
  border-right: 1px solid var(--sb-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

/* Brand */
.aff-sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--sb-border);
  background: var(--sb-bg);
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.aff-sidebar-brand img {
  max-width: 138px;
  height: auto;
  transition: transform 0.3s ease;
}

.aff-sidebar-brand img:hover {
  transform: scale(1.08);
}

.aff-brand-text {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--gold-dark);
  letter-spacing: -.01em;
  display: flex;
  align-items: center;
  gap: 7px;
}

.aff-brand-sub {
  font-size: .62rem;
  color: var(--sb-muted);
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-top: 3px;
  display: block;
}

/* User card */
.aff-user-info {
  padding: 13px 18px;
  border-bottom: 1px solid var(--sb-border);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(221,183,96,.05);
}

.aff-avatar-circle {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-h));
  display: flex; align-items: center; justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700; font-size: .88rem;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,.6);
  box-shadow: 0 2px 6px rgba(221,183,96,.35);
}
.aff-avatar-circle img { width: 100%; height: 100%; object-fit: cover; }

.aff-user-name  { font-size: .81rem; font-weight: 700; color: var(--sb-text); line-height: 1.25; }
.aff-user-code  { font-size: .66rem; color: var(--gold-dark); margin-top: 1px; font-weight: 600; }

/* Nav */
.aff-nav { flex: 1; padding: 8px 10px; }

.aff-nav-label {
  font-size: .58rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--sb-muted);
  padding: 10px 10px 4px;
  font-weight: 700;
}

.aff-nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--sb-text);
  text-decoration: none;
  font-size: .82rem;
  font-weight: 500;
  transition: var(--tr);
  margin-bottom: 2px;
  opacity: .75;
}

.aff-nav a i {
  width: 16px; text-align: center;
  font-size: .82rem; flex-shrink: 0;
  color: var(--sb-muted);
  transition: var(--tr);
}

.aff-nav a:hover {
  background: var(--sb-hover-bg);
  color: var(--sb-hover-tx);
  opacity: 1;
}
.aff-nav a:hover i { color: var(--gold-dark); }

.aff-nav a.active {
  background: var(--gold);
  color: var(--sb-active-tx);
  font-weight: 700;
  opacity: 1;
  box-shadow: 0 2px 8px rgba(221,183,96,.35);
}
.aff-nav a.active i { color: var(--sb-active-tx); }

.nav-badge {
  margin-left: auto;
  background: var(--gold-dark);
  color: #fff;
  border-radius: 99px;
  padding: 1px 7px;
  font-size: .6rem;
  font-weight: 800;
}

/* Sidebar footer */
.aff-nav-footer {
  padding: 13px 18px;
  border-top: 1px solid var(--sb-border);
}

.aff-nav-footer a {
  font-size: .77rem;
  color: var(--sb-muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: var(--tr);
}
.aff-nav-footer a:hover { color: var(--danger); }

/* ══════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════ */
.aff-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Topbar */
.aff-topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 13px 26px;
  display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
  position: sticky; top: 0; z-index: 50;
}

.aff-topbar-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: .97rem; font-weight: 700; color: var(--text);
}
.aff-topbar-sub { font-size: .71rem; color: var(--muted); margin-top: 1px; }
.aff-topbar-actions { display: flex; align-items: center; gap: 8px; }

/* Content */
.aff-content { padding: 22px 26px; flex: 1; }

/* ══════════════════════════════════════
   BUTTONS
══════════════════════════════════════ */
.btn-aff-gold {
  background: var(--gold); color: #1A1000;
  border: none; border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: .81rem; font-weight: 700;
  cursor: pointer; transition: var(--tr);
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.btn-aff-gold:hover {
  background: var(--gold-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-g);
  color: #1A1000;
}

.btn-aff-outline {
  background: transparent; color: var(--gold-dark);
  border: 1.5px solid var(--gold); border-radius: var(--radius-sm);
  padding: 8px 15px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: .81rem; font-weight: 600;
  cursor: pointer; transition: var(--tr);
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-aff-outline:hover { background: var(--gold-bg); color: var(--gold-dark); }

.btn-aff-dark {
  background: #1A1A1A; color: #fff;
  border: none; border-radius: var(--radius-sm);
  padding: 8px 15px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: .81rem; font-weight: 600;
  cursor: pointer; transition: var(--tr);
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-aff-dark:hover { background: #333; }

.btn-aff-light {
  background: var(--white); color: var(--text);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 15px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: .81rem; font-weight: 600;
  cursor: pointer; transition: var(--tr);
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-aff-light:hover { border-color: var(--gold); color: var(--gold-dark); }

.btn-sm { padding: 5px 11px !important; font-size: .74rem !important; }
.btn-xs { padding: 3px 8px !important; font-size: .69rem !important; }

/* ══════════════════════════════════════
   STAT CARDS
══════════════════════════════════════ */
.aff-stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  transition: var(--tr);
  height: 100%;
  position: relative;
  overflow: hidden;
}
.aff-stat-card::before {
  content: '';
  position: absolute; top: 0; right: 0;
  width: 72px; height: 72px;
  background: radial-gradient(circle at top right, var(--gold-bg), transparent 70%);
  pointer-events: none;
}
.aff-stat-card:hover {
  border-color: var(--gold-border);
  box-shadow: var(--shadow-g);
  transform: translateY(-1px);
}
.aff-stat-icon {
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--gold-bg); border: 1px solid var(--gold-border);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold-dark); font-size: .88rem;
  margin-bottom: 12px;
}
.aff-stat-val {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.75rem; font-weight: 700;
  color: var(--text); line-height: 1; margin-bottom: 4px;
}
.aff-stat-label {
  font-size: .68rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .08em; font-weight: 700;
}
.aff-stat-trend { font-size: .71rem; font-weight: 600; margin-top: 5px; }
.aff-stat-trend.up   { color: var(--success); }
.aff-stat-trend.down { color: var(--danger); }
.aff-stat-trend.neu  { color: var(--muted); }

/* ══════════════════════════════════════
   CARD
══════════════════════════════════════ */
.aff-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.aff-card-header {
  padding: 13px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  justify-content: space-between; gap: 10px;
  background: #FAFAF8;
}
.aff-card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700; font-size: .88rem; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.aff-card-title i { color: var(--gold-dark); font-size: .85rem; }
.aff-card-body { padding: 20px; }

/* ══════════════════════════════════════
   LINK BOX
══════════════════════════════════════ */
.aff-link-box {
  background: var(--body);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  display: flex; align-items: center; gap: 10px;
}
.aff-link-box .link-val {
  flex: 1; font-size: .79rem; color: var(--gold-dark);
  font-weight: 600; word-break: break-all;
  font-family: 'Space Grotesk', sans-serif;
}

/* ══════════════════════════════════════
   TABLES
══════════════════════════════════════ */
.aff-table-wrap { overflow-x: auto; }
.aff-table { width: 100%; border-collapse: collapse; font-size: .81rem; }
.aff-table thead tr { background: #F9F9F7; }
.aff-table th {
  padding: 9px 13px; text-align: left;
  font-size: .64rem; text-transform: uppercase;
  letter-spacing: .09em; color: var(--muted);
  font-weight: 700; border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.aff-table td {
  padding: 10px 13px; border-bottom: 1px solid var(--border);
  color: var(--text); vertical-align: middle;
}
.aff-table tr:last-child td { border-bottom: none; }
.aff-table tbody tr:hover td { background: #FFFDF5; }

/* ══════════════════════════════════════
   BADGES
══════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: .63rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;

  --bs-badge-color: inherit !important; /* 🔥 penting */
}

.badge i { font-size: .58rem; }

/* variants */
.badge-gold {
  --bs-badge-color: var(--gold-dark);
  background: rgba(221,183,96,.13);
  border: 1px solid var(--gold-border);
}

.badge-success {
  --bs-badge-color: #15803D;
  background: rgba(22,163,74,.10);
  border: 1px solid rgba(22,163,74,.2);
}

.badge-danger {
  --bs-badge-color: #B91C1C;
  background: rgba(220,38,38,.10);
  border: 1px solid rgba(220,38,38,.2);
}

/* ══════════════════════════════════════
   VISITOR SPECIFIC CHIPS
══════════════════════════════════════ */
.visitor-name-cell { display: flex; flex-direction: column; gap: 1px; }
.visitor-name      { font-size: .82rem; font-weight: 700; color: var(--text); }
.visitor-email     { font-size: .7rem; color: var(--muted); }

.ip-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: #1A1A1A; color: var(--gold);
  border-radius: 6px; padding: 3px 8px;
  font-size: .72rem; font-family: 'Space Grotesk', sans-serif;
  font-weight: 600; letter-spacing: .02em;
}

.source-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--body); border: 1px solid var(--border);
  border-radius: 6px; padding: 3px 8px;
  font-size: .72rem; font-weight: 600; color: var(--text);
  max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.url-text {
  font-size: .73rem; color: var(--info);
  max-width: 160px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; display: block;
}

.time-detail { display: flex; flex-direction: column; gap: 1px; }
.time-date   { font-size: .75rem; font-weight: 700; color: var(--text); white-space: nowrap; }
.time-clock  { font-size: .67rem; color: var(--muted); font-family: 'Space Grotesk', sans-serif; }
.time-ago    { font-size: .63rem; color: var(--gold-dark); font-weight: 600; }

.converted-dot {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .72rem; font-weight: 700;
}
.converted-dot.yes { color: var(--success); }
.converted-dot.no  { color: var(--muted); }

/* ══════════════════════════════════════
   MINI CHART
══════════════════════════════════════ */
.aff-mini-chart { display: flex; align-items: flex-end; gap: 3px; width: 100%; }
.aff-bar {
  flex: 1;
  background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold) 100%);
  border-radius: 4px 4px 0 0; min-height: 3px;
  transition: opacity .15s; cursor: default; position: relative;
}
.aff-bar:hover { opacity: .7; }
.aff-bar:hover::after {
  content: attr(title);
  position: absolute; bottom: calc(100% + 4px); left: 50%;
  transform: translateX(-50%);
  background: #1A1A1A; color: var(--gold);
  font-size: .65rem; white-space: nowrap;
  padding: 3px 7px; border-radius: 4px;
  pointer-events: none; z-index: 10;
}

/* ══════════════════════════════════════
   PROGRESS BAR
══════════════════════════════════════ */
.aff-progress-wrap { background: var(--border); border-radius: 99px; height: 7px; overflow: hidden; }
.aff-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-h), var(--gold-light));
  border-radius: 99px; transition: width .6s ease;
}

/* ══════════════════════════════════════
   PRODUCT CARDS
══════════════════════════════════════ */
.aff-product-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; gap: 10px;
  display: flex; flex-direction: column;
  transition: var(--tr); box-shadow: var(--shadow); height: 90%;
}
.aff-product-card:hover { border-color: var(--gold); box-shadow: var(--shadow-g); }
.aff-product-thumb {
    width: 100%;
    aspect-ratio: 1/1;   /* ← rasio konsisten, tidak gepeng */
    border-radius: 10px;
    overflow: hidden;
    background: var(--gold-bg);
    border: 1px solid var(--gold-border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    font-size: 2rem;
    color: var(--gold);
}
.aff-product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;      /* ← crop tengah, tidak stretch */
    object-position: center;
    display: block;
}
.aff-product-name  { font-family: 'Space Grotesk',sans-serif; font-weight:700; font-size:.93rem; color:var(--text); }
.aff-product-price { font-family: 'Space Grotesk',sans-serif; font-size:1.2rem; font-weight:700; color:var(--gold-dark); }
.aff-product-comm  { font-size:.74rem; color:var(--success); font-weight:600; }

/* ══════════════════════════════════════
   TRAINING CARDS
══════════════════════════════════════ */
.aff-training-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px 16px;
  display: flex; align-items: center; gap: 13px;
  transition: var(--tr); margin-bottom: 7px;
  cursor: pointer; box-shadow: var(--shadow);
}
.aff-training-card:hover    { border-color: var(--gold-border); }
.aff-training-card.done     { border-color: rgba(22,163,74,.3); background: rgba(22,163,74,.03); }
.aff-training-ico {
  width: 42px; height: 42px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; flex-shrink: 0;
}
.aff-training-title  { font-weight:700; font-size:.84rem; color:var(--text); margin-bottom:2px; }
.aff-training-meta   { font-size:.7rem; color:var(--muted); display:flex; align-items:center; gap:8px; }
.aff-training-status { margin-left:auto; flex-shrink:0; }

/* ══════════════════════════════════════
   FORM
══════════════════════════════════════ */
.aff-form-group { display:flex; flex-direction:column; gap:5px; margin-bottom:14px; }
.aff-label { font-size:.68rem; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.07em; }
.aff-input {
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 12px;
  color: var(--text); font-family:'Plus Jakarta Sans',sans-serif;
  font-size:.855rem; width:100%; transition:var(--tr);
}
.aff-input:focus { outline:none; border-color:var(--gold); box-shadow:0 0 0 3px rgba(221,183,96,.10); }
.aff-input::placeholder { color:#C8C8C8; }
.aff-input[readonly] { background:var(--body); color:var(--muted); cursor:default; }

/* ══════════════════════════════════════
   PERIOD SELECTOR
══════════════════════════════════════ */
.aff-period-btns { display:flex; gap:4px; flex-wrap:wrap; }
.aff-period-btn {
  padding:5px 12px; border:1.5px solid var(--border);
  border-radius:var(--radius-sm); background:var(--white);
  color:var(--muted); font-size:.73rem; font-weight:600;
  cursor:pointer; font-family:'Plus Jakarta Sans',sans-serif;
  transition:var(--tr); text-decoration:none;
}
.aff-period-btn.active, .aff-period-btn:hover {
  border-color:var(--gold); color:var(--gold-dark); background:var(--gold-bg);
}

/* ══════════════════════════════════════
   ALERT
══════════════════════════════════════ */
.aff-alert {
  padding:11px 15px; border-radius:var(--radius-sm);
  font-size:.82rem; font-weight:500;
  display:flex; align-items:flex-start; gap:9px;
  margin-bottom:16px; border:1px solid;
}
.aff-alert-success { background:rgba(22,163,74,.07);  border-color:rgba(22,163,74,.2);  color:#15803D; }
.aff-alert-danger  { background:rgba(220,38,38,.07);  border-color:rgba(220,38,38,.2);  color:#B91C1C; }
.aff-alert-gold    { background:var(--gold-bg);        border-color:var(--gold-border);   color:var(--gold-dark); }

/* ══════════════════════════════════════
   COMMUNITY CARDS
══════════════════════════════════════ */
.aff-comm-card {
  background:var(--white); border:1px solid var(--border);
  border-radius:var(--radius); padding:15px 18px;
  display:flex; align-items:center; gap:14px;
  text-decoration:none; color:var(--text);
  transition:var(--tr); margin-bottom:9px; box-shadow:var(--shadow);
}
.aff-comm-card:hover { border-color:var(--gold); transform:translateY(-2px); box-shadow:var(--shadow-g); color:var(--text); }
.aff-comm-ico {
  width:44px; height:44px; border-radius:11px;
  display:flex; align-items:center; justify-content:center;
  font-size:1.1rem; flex-shrink:0;
}

/* ══════════════════════════════════════
   TOAST
══════════════════════════════════════ */
#aff-toast {
  position:fixed; bottom:24px; right:24px;
  background:#1A1A1A; color:var(--gold);
  padding:10px 18px; border-radius:var(--radius-sm);
  font-weight:700; font-size:.81rem; z-index:9999;
  opacity:0; transform:translateY(8px);
  transition:all .3s ease; pointer-events:none;
  border:1px solid var(--gold-border);
  display:flex; align-items:center; gap:8px;
}
#aff-toast.show { opacity:1; transform:translateY(0); }

/* ══════════════════════════════════════
   EMPTY STATE
══════════════════════════════════════ */
.aff-empty { text-align:center; padding:40px 20px; }
.aff-empty .aff-empty-ico { font-size:2rem; color:var(--border); margin-bottom:10px; }
.aff-empty h4 { font-size:.9rem; font-weight:700; color:var(--text); margin-bottom:4px; }
.aff-empty p  { font-size:.79rem; color:var(--muted); }

/* ══════════════════════════════════════
   SECTION TITLE
══════════════════════════════════════ */
.aff-section-title {
  font-family:'Space Grotesk',sans-serif;
  font-size:.77rem; font-weight:700; color:var(--muted);
  text-transform:uppercase; letter-spacing:.1em; margin-bottom:12px;
}

/* ══════════════════════════════════════
   AFFWP NOT ACTIVE WARNING
══════════════════════════════════════ */
.aff-plugin-warn {
  background: rgba(217,119,6,.08);
  border: 1.5px dashed rgba(217,119,6,.4);
  border-radius: var(--radius);
  padding: 20px 24px;
  text-align: center;
  color: #92400E;
  margin-bottom: 20px;
}
.aff-plugin-warn i { font-size: 1.5rem; display: block; margin-bottom: 8px; }
.aff-plugin-warn strong { font-size: .9rem; display: block; margin-bottom: 4px; }
.aff-plugin-warn p { font-size: .8rem; margin: 0; }

/* ══════════════════════════════════════
   MOBILE
══════════════════════════════════════ */
.aff-mobile-toggle {
  display:none; position:fixed; bottom:18px; left:50%;
  transform:translateX(-50%); z-index:200;
  box-shadow:0 4px 20px rgba(0,0,0,.15);
}

@media (max-width:991px) {
  .aff-sidebar {
    position:fixed; top:0; left:0;
    transform:translateX(-100%); transition:transform .3s ease; height:100%;
  }
  .aff-sidebar.open { transform:translateX(0); box-shadow:4px 0 30px rgba(0,0,0,.15); }
  .aff-mobile-toggle { display:flex; }
  .aff-content { padding:18px 14px; }
  .aff-topbar { padding:11px 14px; }
}

@media (max-width:575px) {
  .aff-stat-val { font-size:1.5rem; }
  .aff-content { padding:14px 10px; }
}

/* Scrollbar sidebar */
.aff-sidebar::-webkit-scrollbar { width:3px; }
.aff-sidebar::-webkit-scrollbar-thumb { background:var(--sb-border); border-radius:99px; }



/* TOOLS */
  .tl-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 16px;
    border-radius: 10px;
    font-size: .82rem;
    font-weight: 600;
    line-height: 1.5;
  }

  .tl-alert-ok {
    background: #ECFDF5;
    border: 1px solid #A7F3D0;
    color: #065F46;
  }

  .tl-alert-err {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    color: #991B1B;
  }

  .tl-alert a {
    color: inherit;
    font-weight: 800;
  }

  .tl-alert-close {
    margin-left: auto;
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    opacity: .6;
    color: inherit;
    padding: 0;
    font-size: .8rem;
  }

  .tl-sync-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #FFFBEB, #FEF3C7);
    border: 1.5px solid #FDE68A;
    border-radius: 12px;
    padding: 14px 16px;
  }

  .tl-sync-icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 10px;
    background: #FEF3C7;
    border: 1.5px solid #FDE68A;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #D97706;
    font-size: .95rem;
  }

  .tl-sync-text {
    flex: 1;
    min-width: 0;
  }

  .tl-sync-text strong {
    display: block;
    font-size: .82rem;
    color: #92400E;
    font-weight: 800;
  }

  .tl-sync-text span {
    font-size: .72rem;
    color: #B45309;
  }

  .tl-sync-btn {
    flex-shrink: 0;
    padding: 8px 16px;
    border-radius: 8px;
    background: #D97706;
    color: #fff;
    border: none;
    cursor: pointer;
    font-weight: 800;
    font-size: .76rem;
    white-space: nowrap;
    transition: background .15s;
  }

  .tl-sync-btn:hover {
    background: #B45309;
  }

  .tl-sync-btn:disabled {
    opacity: .6;
    pointer-events: none;
  }

  .tl-progress-track {
    background: #FDE68A;
    border-radius: 6px;
    height: 6px;
    overflow: hidden;
  }

  .tl-progress-bar {
    height: 100%;
    background: #D97706;
    border-radius: 6px;
    width: 0%;
    transition: width .4s ease;
  }

  .tl-progress-label {
    font-size: .72rem;
    color: #92400E;
    margin-top: 5px;
    font-weight: 600;
  }

  .tl-stat {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .04);
  }

  .tl-stat-ico {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
  }

  .tl-stat-val {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--text);
    line-height: 1;
  }

  .tl-stat-lbl {
    font-size: .72rem;
    color: var(--muted);
    font-weight: 600;
    margin-top: 3px;
  }

  .req {
    color: #EF4444;
  }

  .tl-hint {
    font-size: .63rem;
    color: var(--muted);
    margin-top: 3px;
    display: block;
  }

  .tl-badge-pl {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .62rem;
    font-weight: 700;
    background: #F3F0FF;
    border: 1px solid #DDD6FE;
    color: #7C3AED;
    border-radius: 5px;
    padding: 2px 8px;
  }

  .tl-slug-wrap {
    display: flex;
    align-items: stretch;
  }

  .tl-slug-domain {
    background: var(--gold-bg);
    border: 1px solid var(--gold-border);
    border-right: none;
    border-radius: 8px 0 0 8px;
    padding: 0 8px;
    font-size: .66rem;
    font-weight: 700;
    color: var(--gold-dark);
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    max-width: 120px;
    text-overflow: ellipsis;
    flex-shrink: 0;
  }

  .tl-slug-input {
    border-radius: 0 8px 8px 0 !important;
    border-left: none !important;
  }

  .tl-slug-status {
    font-size: .63rem;
    margin-top: 4px;
    min-height: 16px;
  }

  .tl-rtype-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
  }

  .tl-rtype-chip {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    border: 1.5px solid var(--rbd);
    background: var(--rb);
    transition: box-shadow .15s;
  }

  .tl-rtype-chip:has(input:checked) {
    box-shadow: 0 0 0 2px var(--rc);
  }

  .tl-rtype-chip input {
    accent-color: var(--rc);
    margin-top: 2px;
    flex-shrink: 0;
  }

  .tl-rtype-label {
    display: flex;
    flex-direction: column;
    gap: 1px;
  }

  .tl-rtype-label strong {
    font-size: .72rem;
    font-weight: 800;
    color: var(--rc);
  }

  .tl-rtype-label small {
    font-size: .6rem;
    color: var(--rc);
    opacity: .75;
    line-height: 1.3;
  }

  .tl-submit-btn {
    width: 100%;
    justify-content: center;
  }

  .tl-submit-btn.pl-loading {
    opacity: .65;
    pointer-events: none;
  }

  .tl-share-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .tl-share-main-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 8px;
    border-radius: 10px;
    font-size: .76rem;
    font-weight: 700;
    text-decoration: none;
    transition: opacity .15s, transform .1s;
  }

  .tl-share-main-btn:hover {
    opacity: .85;
    transform: translateY(-1px);
    text-decoration: none;
  }

  .tl-share-main-btn.wa {
    background: #DCFCE7;
    color: #15803D;
    border: 1px solid #BBF7D0;
  }

  .tl-share-main-btn.tg {
    background: #DBEAFE;
    color: #1D4ED8;
    border: 1px solid #BFDBFE;
  }

  .tl-share-main-btn.fb {
    background: #EFF6FF;
    color: #1D4ED8;
    border: 1px solid #BFDBFE;
  }

  .tl-share-main-btn.ig {
    background: #FDF2F8;
    color: #9D174D;
    border: 1px solid #FBCFE8;
  }

  .tl-count-badge {
    font-size: .72rem;
    font-weight: 700;
    color: var(--muted);
    background: var(--body);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3px 10px;
  }

  .pl-name {
    font-weight: 700;
    font-size: .82rem;
    color: var(--text);
  }

  .pl-note {
    font-size: .63rem;
    color: var(--muted);
    margin-top: 2px;
  }

  .pl-clicks {
    font-weight: 800;
    font-size: .84rem;
    color: var(--gold-dark);
  }

  .pl-unique {
    font-size: .61rem;
    color: var(--muted);
  }

  .pl-date {
    font-size: .71rem;
    font-weight: 700;
    color: var(--text);
  }

  .pl-time {
    font-size: .62rem;
    color: var(--muted);
  }

  .tl-rtype-badge {
    font-size: .63rem;
    font-weight: 800;
    display: inline-block;
    padding: 2px 7px;
    border-radius: 5px;
    border: 1px solid;
  }

  .tl-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--body);
    color: var(--text);
    cursor: pointer;
    font-size: .76rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, border-color .15s;
  }

  .tl-action-btn:hover {
    background: var(--gold-bg);
    border-color: var(--gold-border);
  }

  .tl-del-btn {
    background: #FEF2F2;
    border-color: #FECACA;
    color: #EF4444;
  }

  .tl-del-btn:hover {
    background: #FEE2E2;
    border-color: #EF4444;
  }

  .tl-del-btn:disabled {
    opacity: .4;
    pointer-events: none;
  }

  .tl-stat-link {
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    padding: 0;
    width: 100%;
  }

  .tl-stat-link:hover .pl-clicks {
    text-decoration: underline;
  }

  .tl-mobile-list {
    padding: 12px 12px 4px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .tl-mobile-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .05);
  }

  .tl-mc-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 14px 10px;
  }

  .tl-mc-info {
    flex: 1;
    min-width: 0;
  }

  .tl-mc-name {
    font-weight: 800;
    font-size: .86rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .tl-mc-note {
    font-size: .7rem;
    color: var(--muted);
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .tl-mc-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--body);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }

  .tl-mc-url {
    flex: 1;
    min-width: 0;
    font-size: .72rem;
    font-weight: 600;
    color: var(--gold-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .tl-mc-copy {
    flex-shrink: 0;
    white-space: nowrap;
  }

  .tl-mc-stats {
    display: flex;
    gap: 14px;
    padding: 10px 14px;
    font-size: .73rem;
    color: var(--muted);
    flex-wrap: wrap;
  }

  .tl-mc-stat {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
  }

  .tl-mc-stat strong {
    color: var(--text);
    font-weight: 800;
  }

  .tl-mc-stat-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    font-size: .73rem;
    padding: 0;
  }

  .tl-mc-stat-btn strong {
    color: var(--gold-dark);
    font-weight: 800;
  }

  .tl-mc-stat-btn:hover strong {
    text-decoration: underline;
  }

  .tl-mc-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 10px 14px 14px;
  }

  .tl-mc-share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px;
    border-radius: 10px;
    border: none;
    background: var(--gold-dark);
    color: #fff;
    font-weight: 800;
    font-size: .8rem;
    cursor: pointer;
    transition: opacity .15s;
  }

  .tl-mc-share-btn:hover {
    opacity: .85;
  }

  .tl-mc-del-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 14px;
    border-radius: 10px;
    background: #FEF2F2;
    border: 1px solid #FECACA;
    color: #EF4444;
    font-weight: 700;
    font-size: .78rem;
    cursor: pointer;
    transition: background .15s;
  }

  .tl-mc-del-btn:hover {
    background: #FEE2E2;
  }

  .tl-mc-del-btn:disabled {
    opacity: .4;
    pointer-events: none;
  }

  .pl-row-removing {
    opacity: 0;
    transform: scaleY(.5);
    pointer-events: none;
    transition: all .3s ease;
  }

  .tl-mobile-card.pl-row-removing {
    opacity: 0;
    transform: scale(.95);
    transition: all .3s ease;
    max-height: 0;
    overflow: hidden;
  }

  .tl-sheet-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 10px;
    border-radius: 14px;
    text-decoration: none;
    font-size: .76rem;
    font-weight: 800;
    transition: opacity .15s, transform .1s;
  }

  .tl-sheet-btn:hover {
    opacity: .85;
    transform: translateY(-2px);
    text-decoration: none;
  }

  .tl-sheet-btn.wa {
    background: #DCFCE7;
    color: #15803D;
  }

  .tl-sheet-btn.tg {
    background: #DBEAFE;
    color: #1D4ED8;
  }

  .tl-sheet-btn.fb {
    background: #EFF6FF;
    color: #1D4ED8;
  }

  .tl-sheet-btn.open {
    background: #F3F4F6;
    color: #374151;
  }

  .tl-sheet-btn span {
    font-size: .73rem;
  }

  /* Stats */
  .stat-sum-box {
    flex: 1;
    min-width: 100px;
    background: var(--body);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    text-align: center;
  }

  .stat-sum-val {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--text);
    line-height: 1;
  }

  .stat-sum-lbl {
    font-size: .65rem;
    color: var(--muted);
    font-weight: 700;
    margin-top: 3px;
    text-transform: uppercase;
    letter-spacing: .05em;
  }

  .stat-chart-canvas-wrap {
    position: relative;
    height: 140px;
  }

  .stat-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .75rem;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
  }

  .stat-table th {
    background: #F9FAFB;
    padding: 9px 12px;
    text-align: left;
    font-size: .68rem;
    font-weight: 800;
    color: #555;
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 1px solid var(--border);
  }

  .stat-table td {
    padding: 9px 12px;
    border-bottom: 1px solid #F9FAFB;
    color: var(--text);
    vertical-align: top;
  }

  .stat-table tr:last-child td {
    border-bottom: none;
  }

  .stat-table tr:hover td {
    background: #FAFAFA;
  }

  .stat-ip {
    font-weight: 700;
    font-family: monospace;
    font-size: .73rem;
  }

  .stat-ip-count {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--gold-bg);
    color: var(--gold-dark);
    font-size: .65rem;
    font-weight: 800;
    margin-left: 5px;
  }

  .stat-ts {
    color: var(--muted);
    font-size: .7rem;
  }

  .stat-ref {
    color: #2563EB;
    font-size: .7rem;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
  }

  @media (max-width: 767px) {
    .tl-rtype-row {
      grid-template-columns: 1fr;
    }

    .tl-stat {
      padding: 12px;
    }

    .tl-stat-val {
      font-size: 1.3rem;
    }
  }