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

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface2: #1e1e1e;
  --border: #2a2a2a;
  --text: #f0f0f0;
  --text-muted: #888;
  --accent: #e1306c;
  --accent2: #833ab4;
  --green: #4ade80;
  --radius: 16px;
  --shadow: 0 8px 40px rgba(0,0,0,.5);
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.page { width: 100%; max-width: 480px; }

.view { display: none; }
.view.active { display: block; }

/* ── FORM CARD ── */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 36px;
  box-shadow: var(--shadow);
}

.brand { text-align: center; margin-bottom: 28px; }
.ig-icon { width: 52px; height: 52px; margin-bottom: 12px; }
.brand h1 {
  font-size: 1.7rem;
  font-weight: 700;
  background: linear-gradient(135deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}
.brand p { color: var(--text-muted); font-size: .9rem; }

/* ── TABS ── */
.tabs {
  display: flex;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 24px;
  gap: 4px;
}
.tab {
  flex: 1;
  padding: 9px 12px;
  border: none;
  border-radius: 7px;
  background: none;
  color: var(--text-muted);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s, color .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.tag-rec {
  font-size: .68rem;
  background: linear-gradient(135deg, #833ab4, #e1306c);
  color: #fff;
  border-radius: 4px;
  padding: 1px 5px;
  font-weight: 600;
}

/* ── HOW-TO ── */
.how-to {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.how-title {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.how-to ol {
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.how-to li {
  font-size: .82rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.how-to strong { color: var(--text); }
kbd {
  background: #2a2a2a;
  border: 1px solid #3a3a3a;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: .78rem;
  font-family: monospace;
}

/* ── FIELDS ── */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: .82rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: .3px;
}

.input-row {
  display: flex;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color .2s;
}
.input-row:focus-within { border-color: var(--accent2); }

.at {
  padding: 0 10px 0 14px;
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 600;
  user-select: none;
}

.input-row input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  padding: 13px 14px 13px 0;
  color: var(--text);
  font-size: .95rem;
  font-family: inherit;
}
.input-row input::placeholder { color: #555; }

.eye-btn {
  background: none;
  border: none;
  padding: 0 12px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}
.eye-btn svg { width: 18px; height: 18px; }
.eye-btn:hover { color: var(--text); }

#sessionid { padding-left: 14px; }

#two_factor {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 14px;
  color: var(--text);
  font-size: .95rem;
  font-family: inherit;
  outline: none;
  transition: border-color .2s;
  letter-spacing: 4px;
}
#two_factor:focus { border-color: var(--accent2); }

.security-note {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
  color: #555;
  margin-bottom: 20px;
  line-height: 1.4;
}
.security-note svg { width: 13px; height: 13px; flex-shrink: 0; }

.btn-primary {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #833ab4, #e1306c, #f77737);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: opacity .2s, transform .1s;
}
.btn-primary:hover { opacity: .9; }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.error-box {
  margin-top: 16px;
  padding: 12px 14px;
  background: rgba(225,48,108,.12);
  border: 1px solid rgba(225,48,108,.3);
  border-radius: 10px;
  color: #f87171;
  font-size: .88rem;
  line-height: 1.5;
}

/* ── LOADING ── */
.loading-card {
  text-align: center;
  padding: 60px 24px;
}
.loading-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 28px;
}
.progress-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.progress-track {
  flex: 1;
  height: 8px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #833ab4, #e1306c, #f77737);
  border-radius: 99px;
  transition: width .4s ease;
}
.progress-pct {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
  min-width: 38px;
  text-align: right;
}
.progress-label {
  font-size: .82rem;
  color: var(--text-muted);
  min-height: 20px;
}
.progress-eta {
  font-size: .78rem;
  color: #555;
  min-height: 18px;
  margin-top: 6px;
}

/* ── RESULTS ── */
.results-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.results-header h2 { font-size: 1.3rem; font-weight: 700; }

.back-btn {
  display: flex; align-items: center; gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  color: var(--text-muted);
  font-size: .85rem;
  cursor: pointer;
  transition: color .2s, border-color .2s;
}
.back-btn:hover { color: var(--text); border-color: #444; }
.back-btn svg { width: 16px; height: 16px; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
}
.stat-card.accent {
  border-color: rgba(225,48,108,.4);
  background: rgba(225,48,108,.08);
}
.stat-num {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
}
.stat-card.accent .stat-num { color: var(--accent); }
.stat-lbl { font-size: .75rem; color: var(--text-muted); margin-top: 4px; display: block; }

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}
.list-header h3 { font-size: .95rem; font-weight: 600; color: var(--text-muted); }

.btn-copy {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 14px;
  color: var(--text);
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .2s;
}
.btn-copy:hover { border-color: #555; }

.users-list { display: flex; flex-direction: column; gap: 8px; }

.user-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  transition: border-color .15s;
}
.user-item:hover { border-color: #3a3a3a; }

.user-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface2);
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-username {
  font-weight: 600;
  font-size: .93rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-fullname {
  font-size: .78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: .78rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 9px;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.user-link:hover { color: var(--text); border-color: #555; }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state .big-check { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: .95rem; }

.warning-box {
  background: rgba(251,191,36,.1);
  border: 1px solid rgba(251,191,36,.3);
  border-radius: 10px;
  padding: 12px 14px;
  color: #fbbf24;
  font-size: .83rem;
  margin-bottom: 20px;
}
.warning-box code {
  background: rgba(255,255,255,.1);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: monospace;
}

/* ── Abas ── */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface2);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 20px;
}
.tab {
  flex: 1;
  padding: 8px 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: .88rem;
  font-weight: 500;
  border-radius: 7px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.tab.active {
  background: var(--surface);
  color: var(--text);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Sessão ── */
.session-check-wrap { display: flex; flex-direction: column; gap: 16px; }
.session-card {
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.session-card.ok  { background: rgba(74,222,128,.08); border: 1px solid rgba(74,222,128,.2); }
.session-card.err { background: rgba(225,48,108,.08); border: 1px solid rgba(225,48,108,.2); }
.session-status { display: flex; align-items: center; gap: 8px; font-size: .88rem; font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot.green { background: #4ade80; }
.dot.red   { background: var(--accent); }
.session-profile { display: flex; align-items: center; gap: 12px; }
.session-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  object-fit: cover; background: var(--surface2); flex-shrink: 0;
}
.session-info { display: flex; flex-direction: column; gap: 2px; }
.session-username { font-size: .9rem; font-weight: 600; }
.session-name  { font-size: .8rem; color: var(--text-muted); }
.session-stats { font-size: .78rem; color: var(--text-muted); margin-top: 2px; }
.session-err-msg { font-size: .82rem; color: #f87171; }

.hidden { display: none !important; }

.api-note {
  margin-bottom: 12px;
  padding: 10px 14px;
  background: rgba(251,191,36,.08);
  border: 1px solid rgba(251,191,36,.25);
  border-radius: 10px;
  color: #fbbf24;
  font-size: .82rem;
  line-height: 1.5;
}

.progress-note {
  font-size: .72rem;
  color: #444;
  margin-top: 10px;
}

.btn-secondary {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface2);
  color: var(--text-muted);
  font-size: .88rem;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 12px;
  transition: border-color .2s, color .2s;
}
.btn-secondary:hover { border-color: #444; color: var(--text); }

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.admin-title { font-weight: 600; font-size: .95rem; }
.admin-logout {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  color: var(--text-muted);
  font-size: .78rem;
  cursor: pointer;
}
.admin-logout:hover { color: var(--text); border-color: #555; }

.admin-jobs { display: flex; flex-direction: column; gap: 10px; }
.admin-loading, .admin-empty { font-size: .85rem; color: var(--text-muted); text-align: center; padding: 16px 0; }

.admin-job-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.admin-job-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.admin-job-status {
  font-size: .72rem;
  font-weight: 700;
  border-radius: 4px;
  padding: 2px 7px;
}
.admin-job-status.run  { background: rgba(251,191,36,.15); color: #fbbf24; }
.admin-job-status.done { background: rgba(74,222,128,.15);  color: #4ade80; }
.admin-job-status.err  { background: rgba(225,48,108,.15);  color: var(--accent); }
.admin-job-age { font-size: .72rem; color: #555; margin-left: auto; }
.admin-cancel {
  background: rgba(225,48,108,.1);
  border: 1px solid rgba(225,48,108,.3);
  border-radius: 5px;
  color: var(--accent);
  font-size: .72rem;
  padding: 2px 8px;
  cursor: pointer;
}
.admin-cancel:hover { background: rgba(225,48,108,.2); }
.admin-job-label { font-size: .82rem; color: var(--text-muted); margin-bottom: 6px; }
.admin-job-error { font-size: .78rem; color: #f87171; margin-bottom: 6px; }
.admin-job-bar {
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 6px;
}
.admin-job-fill {
  height: 100%;
  background: linear-gradient(90deg, #833ab4, #e1306c);
  border-radius: 99px;
  transition: width .4s;
}
.admin-job-id { font-size: .65rem; color: #333; font-family: monospace; word-break: break-all; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 400px) {
  .form-card { padding: 28px 20px; }
  .stats-row { gap: 8px; }
  .stat-num { font-size: 1.2rem; }
}
