* { margin: 0; padding: 0; box-sizing: border-box; }
:root { --accent: #a855f7; --accent2: #ec4899; }
body {
  font-family: 'Sora', system-ui, sans-serif;
  background: radial-gradient(circle at 20% 0%, #1a0b2e, #05040a 60%);
  color: #f0f0f4;
  min-height: 100vh;
}
.hidden { display: none !important; }
.muted { color: rgba(255,255,255,0.5); }
.small { font-size: 0.82rem; }
.error { color: #ff6b6b; font-size: 0.85rem; min-height: 1em; margin-top: 4px; }
.hint { color: rgba(255,255,255,0.45); font-size: 0.8rem; margin-top: 6px; }
a { color: var(--accent); text-decoration: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 10px;
  font-family: inherit; font-size: 0.9rem; font-weight: 600;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06); color: #fff;
  cursor: pointer; transition: transform .12s ease, background .2s ease, box-shadow .2s ease;
}
.btn:hover { background: rgba(255,255,255,0.12); }
.btn:active { transform: scale(0.97); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none; box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 40%, transparent);
}
.btn.ghost { background: rgba(255,255,255,0.05); }
.btn.full { width: 100%; justify-content: center; margin-top: 8px; }
.btn.danger { background: rgba(255,80,80,0.15); border-color: rgba(255,80,80,0.3); color: #ff8a8a; }

/* ---------- login ---------- */
.login-view { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card {
  width: min(380px, 100%);
  display: flex; flex-direction: column; gap: 14px;
  padding: 36px 30px; border-radius: 20px; text-align: center;
  background: rgba(20,12,34,0.6); border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(16px); box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.logo {
  width: 56px; height: 56px; margin: 0 auto 6px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center; font-size: 1.5rem;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 0 24px color-mix(in srgb, var(--accent) 50%, transparent);
}
.login-card h1 { font-size: 1.6rem; font-weight: 800; }
.login-card input {
  padding: 13px 15px; border-radius: 10px; font-size: 0.95rem;
  background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.14); color: #fff;
}
.login-card input:focus { outline: none; border-color: var(--accent); }

/* ---------- editor layout ---------- */
.editor-view { max-width: 720px; margin: 0 auto; padding: 20px 16px 80px; }
.top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 18px; flex-wrap: wrap;
}
.brand { font-weight: 800; font-size: 1.2rem; }
.brand i { color: var(--accent); }
.top-actions { display: flex; gap: 8px; }

.tabs {
  display: flex; gap: 6px; margin-bottom: 20px; overflow-x: auto; padding-bottom: 4px;
}
.tab {
  flex: none; padding: 9px 14px; border-radius: 10px; cursor: pointer;
  font-family: inherit; font-size: 0.85rem; font-weight: 600; white-space: nowrap;
  background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.6);
  border: 1px solid transparent; transition: all .18s ease;
}
.tab:hover { color: #fff; }
.tab.active { color: #fff; background: rgba(168,85,247,0.18); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }

.panel { display: none; animation: fade .25s ease; }
.panel.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- fields ---------- */
.field { margin-bottom: 18px; }
.field > label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 8px; color: rgba(255,255,255,0.8); }
.field input[type="text"], .field textarea, .field select {
  width: 100%; padding: 12px 14px; border-radius: 10px; font-family: inherit; font-size: 0.92rem;
  background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.14); color: #fff; resize: vertical;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--accent); }
.field input[type="range"] { width: 100%; accent-color: var(--accent); }
.field input[type="color"] { width: 60px; height: 40px; border: none; background: none; border-radius: 8px; cursor: pointer; }
select option { background: #14091f; }

.check { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: 0.9rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.check.tiny { font-size: 0.78rem; margin: 2px 0 0; gap: 6px; color: rgba(255,255,255,0.7); }
.check.tiny input { width: 15px; height: 15px; }
hr { border: none; border-top: 1px solid rgba(255,255,255,0.1); margin: 20px 0; }

/* ---------- upload previews ---------- */
.upload-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.avatar-preview {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
  background: rgba(255,255,255,0.08); border: 2px solid var(--accent);
}
.avatar-preview[src=""], .avatar-preview:not([src]) { visibility: hidden; }
.video-preview {
  width: 120px; height: 68px; border-radius: 8px; object-fit: cover;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14);
}

/* ---------- links editor ---------- */
.links-list { display: flex; flex-direction: column; gap: 12px; }
.link-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px; align-items: center;
  padding: 12px; border-radius: 12px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
}
.link-row .row-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.link-row select, .link-row input {
  padding: 9px 11px; border-radius: 8px; font-family: inherit; font-size: 0.88rem;
  background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.14); color: #fff; width: 100%;
}
.link-row input:focus, .link-row select:focus { outline: none; border-color: var(--accent); }
.link-icon {
  width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; background: rgba(255,255,255,0.06);
}
.row-controls { display: flex; flex-direction: column; gap: 6px; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  border: 1px solid rgba(255,255,255,0.14); background: rgba(255,255,255,0.05); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 0.75rem;
}
.icon-btn:hover { background: rgba(255,255,255,0.12); }
.icon-btn.del:hover { background: rgba(255,80,80,0.2); color: #ff8a8a; }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  padding: 12px 22px; border-radius: 12px; font-weight: 600; font-size: 0.9rem;
  background: rgba(20,12,34,0.95); border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5); opacity: 0; transition: all .3s ease; z-index: 100;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.ok { border-color: rgba(74,222,128,0.4); }
.toast.err { border-color: rgba(255,107,107,0.5); color: #ff9b9b; }

/* ---------- two column ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 480px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- badge picker ---------- */
.badge-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.badge-opt {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 12px; border-radius: 10px; cursor: pointer; user-select: none;
  font-size: 0.85rem; font-weight: 600;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.12);
  transition: all .15s ease;
}
.badge-opt i { font-size: 1rem; }
.badge-opt:hover { background: rgba(255,255,255,0.1); }
.badge-opt.on {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 35%, transparent);
}

/* ---------- analytics ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-card {
  padding: 16px 10px; border-radius: 14px; text-align: center;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
}
.stat-num { font-size: 1.8rem; font-weight: 800; color: var(--accent); }
.stat-lbl { font-size: 0.78rem; color: rgba(255,255,255,0.55); margin-top: 2px; }
.mini-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.mini-row {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 9px 12px; border-radius: 9px; font-size: 0.85rem;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
}
.mini-row .r { color: rgba(255,255,255,0.55); font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; }
.mini-row.empty { justify-content: center; color: rgba(255,255,255,0.4); }
.vpn-tag {
  display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 6px;
  font-size: 0.68rem; font-weight: 700; color: #ffb454;
  background: rgba(255,140,0,0.16); border: 1px solid rgba(255,140,0,0.4);
}

/* ---------- activity chart ---------- */
.chart-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.period-btns { display: flex; gap: 4px; }
.period {
  padding: 5px 11px; border-radius: 8px; font-family: inherit; font-size: 0.78rem; font-weight: 600;
  cursor: pointer; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.12); color: rgba(255,255,255,0.6);
}
.period.active { color: #fff; background: color-mix(in srgb, var(--accent) 25%, transparent); border-color: var(--accent); }
.chart {
  display: flex; align-items: flex-end; gap: 3px; height: 150px; padding: 8px;
  border-radius: 12px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); overflow-x: auto;
}
.bar { flex: 1 0 5px; min-width: 4px; height: 100%; display: flex; align-items: flex-end; }
.bar-fill {
  width: 100%; background: linear-gradient(180deg, var(--accent), var(--accent2));
  border-radius: 3px 3px 0 0; min-height: 2px; transition: height 0.3s ease;
}
.bar:hover .bar-fill { filter: brightness(1.35); }

/* ---------- world map ---------- */
.world-map {
  height: 300px; border-radius: 12px; overflow: hidden;
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08);
}

/* ---------- clickable event rows ---------- */
.ev-row { cursor: pointer; }
.ev-row:hover { background: rgba(255,255,255,0.09); }

/* ---------- visitor detail modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  background: rgba(3,2,8,0.75); backdrop-filter: blur(6px); padding: 20px;
}
.modal-card {
  width: min(520px, 100%); max-height: 88vh; overflow-y: auto;
  background: #120b20; border: 1px solid rgba(255,255,255,0.16);
  border-radius: 18px; box-shadow: 0 24px 70px rgba(0,0,0,0.6);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; font-weight: 800; font-size: 1.05rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  position: sticky; top: 0; background: #120b20;
}
.modal-body { padding: 8px 18px 18px; }
.det-group { margin-top: 16px; }
.det-group h4 {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--accent); margin-bottom: 8px;
}
.det {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.06); font-size: 0.88rem;
}
.det .k { color: rgba(255,255,255,0.55); }
.det .v { text-align: right; word-break: break-word; }
.det .v a { color: var(--accent); }
.copy-mini {
  margin-left: 6px; cursor: pointer; color: rgba(255,255,255,0.5);
  background: none; border: none; font-size: 0.82rem;
}
.copy-mini:hover { color: #fff; }
.tag-yes { color: #ffb454; font-weight: 700; }
.tag-no { color: rgba(255,255,255,0.55); }

/* ---------- live preview pane ---------- */
.preview-pane {
  position: fixed;
  z-index: 200;
  right: 16px; bottom: 16px;
  width: 390px; max-width: calc(100vw - 32px);
  height: 720px; max-height: calc(100vh - 32px);
  background: #05040a;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  display: flex; flex-direction: column;
}
.preview-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; font-size: 0.85rem; font-weight: 600;
  background: rgba(20,12,34,0.9); border-bottom: 1px solid rgba(255,255,255,0.1);
}
.preview-bar i { color: var(--accent); }
.preview-actions { display: flex; gap: 6px; }
.preview-actions .btn { padding: 6px 10px; }
#previewFrame { flex: 1; width: 100%; border: none; background: #05040a; }
