:root {
  --primary: #6c5ce7; --secondary: #a29bfe; --accent: #00cec9;
  --bg: #f8f9fd; --card: #ffffff; --text: #2d3436; --muted: #636e72;
  --border: rgba(0,0,0,0.08); --error: #ff7675; --success: #00b894;
  --warning: #fdcb6e; --nav-bg: #ffffff;
}
body.dark {
  --bg: #0d0d14; --card: #161622; --text: #e8e8f0; --muted: #8888aa;
  --border: rgba(255,255,255,0.08); --nav-bg: #13131f;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Outfit', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; transition: background 0.3s, color 0.3s; }

.navbar {
  background: var(--nav-bg); padding: 0 32px; height: 65px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06); position: sticky; top: 0; z-index: 100;
  transition: background 0.3s;
}
.navbar-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.navbar-brand img { width: 36px; height: 36px; border-radius: 9px; }
.navbar-brand span { font-weight: 800; font-size: 1.15rem; color: var(--primary); }
.navbar-links { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nav-link-btn {
  padding: 8px 16px; border-radius: 8px; font-family: 'Outfit', sans-serif;
  font-weight: 600; font-size: 0.88rem; text-decoration: none;
  transition: all 0.2s; cursor: pointer; border: none; color: var(--muted);
}
.nav-link-btn.outline { background: none; border: 1.5px solid var(--border); }
.nav-link-btn.outline:hover { color: var(--primary); border-color: var(--primary); background: rgba(108,92,231,0.06); }
.nav-link-btn.active-page { color: var(--primary); border: 1.5px solid var(--primary); background: rgba(108,92,231,0.06); }
.nav-link-btn.danger { background: rgba(255,118,117,0.1); color: var(--error); }
.nav-link-btn.danger:hover { background: var(--error); color: white; }
.theme-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--border);
  background: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 0.88rem; transition: all 0.2s; flex-shrink: 0;
}
.theme-btn:hover { color: var(--primary); border-color: var(--primary); background: rgba(108,92,231,0.06); }

/* ── ADMIN NAV BUTTON ── */
.nav-link-btn.admin-btn {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff !important;
  border: none;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(108,92,231,0.3);
}
.nav-link-btn.admin-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(108,92,231,0.45);
  opacity: 0.92;
}

.content { max-width: 820px; margin: 0 auto; padding: 36px 20px; }

.profile-header {
  display: flex; align-items: center; gap: 20px; background: var(--card);
  border: 1px solid var(--border); border-radius: 20px; padding: 28px;
  margin-bottom: 24px; box-shadow: 0 2px 12px rgba(0,0,0,0.05);
  transition: background 0.3s; position: relative; overflow: hidden;
}
.profile-header::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.profile-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; color: white; font-weight: 800; flex-shrink: 0;
  cursor: pointer; position: relative; overflow: hidden;
  transition: transform .2s, box-shadow .2s; align-self: center;
}
.profile-avatar:hover { transform: scale(1.06); box-shadow: 0 6px 20px rgba(108,92,231,.35); }
.profile-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-avatar .avatar-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .2s; font-size: 1rem; color: #fff; z-index: 2;
}
.profile-avatar:hover .avatar-overlay { opacity: 1; }
.profile-info { display: flex; flex-direction: column; justify-content: center; flex: 1; }
.profile-info h2 { font-size: 1.4rem; font-weight: 800; line-height: 1.2; }
.profile-info p { color: var(--muted); font-size: 0.88rem; margin-top: 3px; }
.profile-badges { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.p-badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 12px;
  border-radius: 999px; font-size: 0.75rem; font-weight: 700;
}
.p-badge.green  { background: rgba(0,184,148,0.12);   color: var(--success); border: 1px solid rgba(0,184,148,0.25); }
.p-badge.purple { background: rgba(108,92,231,0.1);   color: var(--primary); border: 1px solid rgba(108,92,231,0.2); }
.p-badge.blue   { background: rgba(0,206,201,0.1);    color: var(--accent);  border: 1px solid rgba(0,206,201,0.2); }
.p-badge.yellow { background: rgba(253,203,110,0.15); color: #b7830a;        border: 1px solid rgba(253,203,110,0.4); }
.p-badge.red    { background: rgba(255,118,117,0.12); color: var(--error);   border: 1px solid rgba(255,118,117,0.3); }
body.dark .p-badge.yellow { color: var(--warning); }

.verify-banner {
  display: none; align-items: center; gap: 12px; padding: 14px 20px;
  background: rgba(253,203,110,0.1); border: 1px solid rgba(253,203,110,0.4);
  border-radius: 14px; margin-bottom: 20px;
}
.verify-banner.show { display: flex; }
.verify-banner-text { flex: 1; font-size: 0.88rem; }
.verify-banner-text strong { display: block; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.verify-banner-text span { color: var(--muted); font-size: 0.82rem; }
.btn-verify {
  padding: 8px 16px; border-radius: 8px; border: none; background: var(--warning);
  color: #7d5a00; font-family: 'Outfit',sans-serif; font-weight: 700; font-size: 0.82rem;
  cursor: pointer; white-space: nowrap; transition: all .2s;
}
.btn-verify:hover { background: #f0b429; }
.btn-verify:disabled { opacity: 0.6; cursor: not-allowed; }

.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }
.info-tile {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 20px; transition: background 0.3s;
}
.info-tile-icon {
  width: 36px; height: 36px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.95rem; margin-bottom: 12px;
}
.iti-purple { background: rgba(108,92,231,0.12); color: var(--primary); }
.iti-green  { background: rgba(0,184,148,0.12);  color: var(--success); }
.iti-orange { background: rgba(253,203,110,0.2);  color: #e67e22; }
.iti-blue   { background: rgba(0,206,201,0.12);   color: var(--accent); }
.info-tile-label { font-size: 0.78rem; color: var(--muted); font-weight: 500; margin-bottom: 3px; }
.info-tile-value { font-size: 1.1rem; font-weight: 800; color: var(--text); }
.info-tile-sub   { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

.section-card {
  background: var(--card); border-radius: 16px; padding: 28px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05); border: 1px solid var(--border);
  margin-bottom: 20px; transition: background 0.3s, border-color 0.3s;
}
.section-card h4 {
  font-size: 1.05rem; font-weight: 700; margin-bottom: 6px;
  display: flex; align-items: center; gap: 10px; color: var(--text);
}
.section-card h4 i { color: var(--primary); }
.section-desc { font-size: 0.85rem; color: var(--muted); margin-bottom: 18px; }

/* ── ADMIN PANEL CARD ── */
.admin-panel-card {
  border-color: rgba(108,92,231,0.3);
  background: linear-gradient(135deg, rgba(108,92,231,0.03) 0%, rgba(162,155,254,0.05) 100%);
  position: relative; overflow: hidden;
}
.admin-panel-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}
body.dark .admin-panel-card {
  background: linear-gradient(135deg, rgba(108,92,231,0.08) 0%, rgba(162,155,254,0.06) 100%);
}
.btn-admin-panel {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 14px 20px; border-radius: 12px;
  border: none; cursor: pointer; text-decoration: none;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff; font-family: 'Outfit', sans-serif;
  font-weight: 700; font-size: 0.95rem;
  transition: all 0.2s; box-shadow: 0 4px 14px rgba(108,92,231,0.3);
}
.btn-admin-panel:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(108,92,231,0.4);
}
.btn-admin-panel span { flex: 1; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; font-size: 0.85rem; color: var(--text); margin-bottom: 7px; }
.input-wrap { position: relative; }
.input-wrap i.icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 0.9rem; pointer-events: none;
}
.form-control {
  width: 100%; padding: 11px 14px 11px 40px; border: 1.5px solid var(--border);
  border-radius: 10px; font-family: 'Outfit', sans-serif; font-size: 0.93rem;
  color: var(--text); background: var(--bg);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.3s; outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108,92,231,0.12); }
.form-control.is-invalid { border-color: var(--error); box-shadow: 0 0 0 3px rgba(255,118,117,.1); }
.form-control.is-valid   { border-color: var(--success); }
.form-control.has-toggle { padding-right: 40px; }
.input-wrap .pw-toggle {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 4px; font-size: 0.88rem; transition: color .2s;
}
.input-wrap .pw-toggle:hover { color: var(--primary); }

.btn-save {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 22px;
  border-radius: 10px; border: none;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white; font-family: 'Outfit', sans-serif; font-weight: 700;
  font-size: 0.9rem; cursor: pointer; transition: all 0.2s;
}
.btn-save:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(108,92,231,0.35); }
.btn-save:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-danger-outline {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px;
  border-radius: 10px; border: 1.5px solid rgba(255,118,117,0.35);
  background: rgba(255,118,117,0.06); color: var(--error);
  font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 0.9rem;
  cursor: pointer; transition: all 0.2s;
}
.btn-danger-outline:hover { background: var(--error); color: white; border-color: var(--error); }
.btn-danger-outline:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

@keyframes spin { to { transform: rotate(360deg); } }
.spin { display: inline-block; animation: spin 0.7s linear infinite; }

.alert {
  padding: 12px 16px; border-radius: 10px; font-size: 0.88rem;
  margin-bottom: 16px; display: none; align-items: center; gap: 10px;
}
.alert.show { display: flex; }
.alert-success { background: rgba(0,184,148,0.1); color: var(--success); border: 1px solid rgba(0,184,148,0.25); }
.alert-error   { background: rgba(255,118,117,0.1); color: var(--error); border: 1px solid rgba(255,118,117,0.25); }

.apikey-box {
  display: flex; align-items: center; gap: 10px; background: var(--bg);
  border: 1.5px solid var(--border); border-radius: 10px;
  padding: 12px 16px; margin-bottom: 10px; transition: background 0.3s;
}
.apikey-box code {
  flex: 1; font-size: 0.92rem; color: var(--primary);
  font-family: 'Consolas', monospace; word-break: break-all;
}
.icon-btn {
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 6px; border-radius: 6px; transition: all 0.2s; font-size: 0.9rem;
}
.icon-btn:hover { color: var(--primary); background: rgba(108,92,231,0.1); }

.field-hint { font-size: 0.75rem; margin-top: 5px; display: none; }
.field-hint.show { display: block; }
.field-hint.ok  { color: var(--success); }
.field-hint.err { color: var(--error); }

.quota-info { margin-bottom: 8px; display: flex; justify-content: space-between; font-size: 0.88rem; }
.quota-bar  { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); margin-bottom: 8px; }
.quota-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width 0.6s ease; }
.quota-fill.warning { background: linear-gradient(90deg, var(--warning), var(--error)); }

.pw-strength { display: flex; gap: 4px; margin-top: 8px; }
.pw-bar { flex: 1; height: 3px; border-radius: 999px; background: var(--border); transition: background 0.3s; }
.pw-bar.weak   { background: var(--error); }
.pw-bar.medium { background: var(--warning); }
.pw-bar.strong { background: var(--success); }
.pw-label { font-size: 0.75rem; color: var(--muted); margin-top: 4px; }

.confirm-hint { font-size: 0.75rem; margin-top: 5px; display: none; }
.confirm-hint.show   { display: block; }
.confirm-hint.match  { color: var(--success); }
.confirm-hint.nomatch{ color: var(--error); }

.avatar-ext-hint { font-size: .76rem; color: var(--muted); margin-bottom: 14px; }
.avatar-ext-hint span {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 6px; font-family: monospace;
  font-size: .75rem; margin-right: 3px;
}

.log-table-wrap { overflow-x: auto; margin-top: 4px; }
.log-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.log-table th {
  text-align: left; color: var(--muted); font-weight: 600;
  padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.log-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.log-table tr:last-child td { border-bottom: none; }
.log-table tr:hover td { background: rgba(108,92,231,0.04); }
.log-status {
  display: inline-flex; align-items: center; padding: 2px 9px;
  border-radius: 999px; font-weight: 700; font-size: 0.75rem;
}
.log-status.ok  { background: rgba(0,184,148,0.12); color: var(--success); }
.log-status.err { background: rgba(255,118,117,0.1); color: var(--error); }
.log-empty { text-align: center; padding: 24px; color: var(--muted); font-size: 0.85rem; }

.info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: var(--bg);
  border-radius: 10px; border: 1px solid var(--border);
}
.info-row-label { font-size: 0.8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.info-row-value { font-size: 0.95rem; font-weight: 700; margin-top: 2px; display: flex; align-items: center; gap: 8px; }
.info-rows { display: grid; gap: 12px; }

.section-card.danger-zone { border-color: rgba(255,118,117,0.3); }
.section-card.danger-zone h4 i { color: var(--error); }
.danger-item {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px; background: rgba(255,118,117,0.04);
  border: 1px solid rgba(255,118,117,0.15); border-radius: 12px; flex-wrap: wrap;
}
.danger-item-text strong { display: block; font-size: 0.9rem; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.danger-item-text span { font-size: 0.82rem; color: var(--muted); }

.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.7);
  z-index: 999; align-items: center; justify-content: center;
  padding: 20px; backdrop-filter: blur(4px);
}
.modal-overlay.show { display: flex; animation: fadeIn .15s ease; }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
.modal-box {
  background: var(--card); border-radius: 20px; padding: 24px;
  max-width: 440px; width: 100%; box-shadow: 0 24px 80px rgba(0,0,0,.3); position: relative;
}
.modal-box.danger { border: 1.5px solid rgba(255,118,117,0.3); }
.modal-close {
  position: absolute; top: 16px; right: 16px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 50%; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--muted); font-size: .85rem; transition: all .2s;
}
.modal-close:hover { color: var(--error); border-color: var(--error); background: rgba(255,118,117,.08); }
.modal-avatar-img { width: 100%; border-radius: 14px; object-fit: cover; max-height: 400px; display: block; }
.modal-avatar-fallback {
  width: 100%; height: 200px; border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  font-size: 5rem; color: #fff; font-weight: 800;
}
.modal-title { font-weight: 700; font-size: .95rem; margin-bottom: 14px; color: var(--text); }
.modal-body  { font-size: 0.88rem; color: var(--muted); margin-bottom: 20px; line-height: 1.6; }
.modal-body strong { color: var(--error); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

@media (max-width: 768px) {
  .navbar { padding: 0 16px; height: auto; min-height: 65px; flex-wrap: wrap; gap: 8px; padding-top: 10px; padding-bottom: 10px; }
  .navbar-brand span { font-size: 1rem; }
  .navbar-links { gap: 6px; }
  .nav-link-btn { padding: 6px 10px; font-size: 0.78rem; }
  .nav-link-btn i { margin-right: 2px; }
}

@media (max-width: 600px) {
  .navbar { padding: 10px 14px; }
  .navbar-links { width: 100%; justify-content: flex-start; }
  .nav-link-btn span, .nav-link-btn { font-size: 0.76rem; padding: 6px 10px; }

  .content { padding: 16px 14px; }

  .profile-header { flex-direction: column; text-align: center; align-items: center; padding: 24px 20px; gap: 14px; }
  .profile-header::before { height: 3px; }
  .profile-info { align-items: center; }
  .profile-info h2 { font-size: 1.2rem; }
  .profile-badges { justify-content: center; }

  .info-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .info-tile { padding: 16px; }
  .info-tile-value { font-size: 1rem; }

  .section-card { padding: 20px 16px; }
  .section-card h4 { font-size: 0.95rem; }

  .apikey-box { flex-wrap: wrap; gap: 8px; }
  .apikey-box code { font-size: 0.78rem; word-break: break-all; width: 100%; }

  .btn-save, .btn-danger-outline { width: 100%; justify-content: center; font-size: 0.88rem; }
  .btn-row { flex-direction: column; }
  .btn-row .btn-save, .btn-row .btn-danger-outline { width: 100%; }
  .btn-admin-panel { font-size: 0.88rem; padding: 12px 16px; }

  .form-control { font-size: 0.88rem; }

  .info-row { flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px; }
  .info-row > i { display: none; }
  .info-row-value { font-size: 0.88rem; }

  .danger-item { flex-direction: column; align-items: flex-start; }
  .danger-item .btn-danger-outline { width: 100%; justify-content: center; }

  .log-table { font-size: 0.76rem; }
  .log-table th, .log-table td { padding: 7px 8px; }

  .modal-box { padding: 20px 16px; border-radius: 16px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn-save, .modal-actions .btn-danger-outline { width: 100%; justify-content: center; }

  .verify-banner { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px 16px; }
  .btn-verify { width: 100%; justify-content: center; text-align: center; }

  #verifyOtpRow { flex-direction: column !important; align-items: stretch !important; }
  #verifyOtpInput { width: 100% !important; }
}

@media (max-width: 380px) {
  .info-grid { grid-template-columns: 1fr; }
  .navbar-links .nav-link-btn:not(.active-page):not(.danger):not(.theme-btn):not(.admin-btn) { display: none; }
}